
rm(list=ls(all=TRUE))

library(lfe)
library(car)
library(xtable)
library(stargazer)
library(plyr)
library(wfe)

setwd("~/Dropbox/UK_Employment/replication")




## Functions

sumfunc <- function(data){
	t(rbind(
		round(apply(data, 2, mean, na.rm=T),3),
		round(apply(data, 2, sd, na.rm=T),3),
		round(apply(data, 2, min, na.rm=T),3),
		round(apply(data, 2, max, na.rm=T),3)
	))
}


load("data/main.rda")



### SECTION B: Descriptive Statistics


# Tab A1
outtab <- rbind(
	sumfunc(as.matrix(data$earnings.all.infl.log.1)),
	sumfunc(as.matrix(data$earnings.work.infl.log.1)),
	sumfunc(as.matrix(data$earnings.press.infl.log.1)),
	sumfunc(as.matrix(data$earnings.speech.infl.log.1)),
	sumfunc(as.matrix(data$minister)),
	sumfunc(as.matrix(data$minister.state)),
	sumfunc(as.matrix(data$undersec)),
	sumfunc(as.matrix(data$shadow.cabinet)),
	sumfunc(as.matrix(data$frontbench.team)),
	sumfunc(as.matrix(data$com.chair)),
	sumfunc(as.matrix(data$com.member)),
	sumfunc(as.matrix(data$minister.post)),
	sumfunc(as.matrix(data$minister.state.post)),
	sumfunc(as.matrix(data$undersec.post)),
	sumfunc(as.matrix(data$shadow.cabinet.post)),
	sumfunc(as.matrix(data$frontbench.team.post)),
	sumfunc(as.matrix(data$com.chair.post)),
	sumfunc(as.matrix(data$com.member.post)),
	sumfunc(as.matrix(data$enter)),
	sumfunc(as.matrix(data$leave))
					)

rownames(outtab) <- c("Log Earnings, Total", "Log Earnings, Work", "Log Earnings, Press", "Log Earnings, Speeches", "Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member", "Post-Minister", "Post-Minister of State", "Post-Parliamentary Secretary", "Post-Shadow Cabinet", "Post-Frontbench Team", "Post-Committee Chair", "Post-Committee Member", "Enter Office", "Leave Office")
colnames(outtab) <- c("Mean", "SD", "Min", "Max")

outtable <- xtable(outtab, digits=3)
print(outtable, file="output/appendix/tab_a1.tex")




# Tab A2
outtab <- rbind(
	c("Gender", "", "", "", ""),
	c("Male", round(mean(data$earnings.all.infl[data$gender=="male"]>0, na.rm=T), 3), round(mean(data$earnings.all.infl[data$gender=="male" & data$earnings.all.infl>0], na.rm=T), 0), length(data$id[data$gender=="male"]),  length(unique(data$id[data$gender=="male"]))),
	c("Female", round(mean(data$earnings.all.infl[data$gender=="female"]>0, na.rm=T), 3), round(mean(data$earnings.all.infl[data$gender=="female" & data$earnings.all.infl>0], na.rm=T), 0), length(data$id[data$gender=="female"]), length(unique(data$id[data$gender=="female"]))),
	c("Party", "", "", "", ""),
	c("Conservative", round(mean(data$earnings.all.infl[data$party=="Conservative"]>0, na.rm=T), 3), round(mean(data$earnings.all.infl[data$party=="Conservative" & data$earnings.all.infl>0], na.rm=T), 0), length(data$id[data$party=="Conservative"]),  length(unique(data$id[data$party=="Conservative"]))),
	c("Labour", round(mean(data$earnings.all.infl[data$party=="Labour" | data$party=="Labour/Co-operative" | data$party=="Social Democratic and Labour Party"]>0, na.rm=T), 3), round(mean(data$earnings.all.infl[(data$party=="Labour" | data$party=="Labour/Co-operative" | data$party=="Social Democratic and Labour Party") & data$earnings.all.infl>0], na.rm=T), 0), length(data$id[data$party=="Labour" | data$party=="Labour/Co-operative" | data$party=="Social Democratic and Labour Party"]),  length(unique(data$id[data$party=="Labour" | data$party=="Labour/Co-operative" | data$party=="Social Democratic and Labour Party"]))),
	c("Liberal Democrat", round(mean(data$earnings.all.infl[data$party=="Liberal Democrat"]>0, na.rm=T), 3), round(mean(data$earnings.all.infl[data$party=="Liberal Democrat" & data$earnings.all.infl>0], na.rm=T), 0), length(data$id[data$party=="Liberal Democrat"]),  length(unique(data$id[data$party=="Liberal Democrat"]))),
	c("Scottish National Party", round(mean(data$earnings.all.infl[data$party=="Scottish National Party"]>0, na.rm=T), 3), round(mean(data$earnings.all.infl[data$party=="Scottish National Party" & data$earnings.all.infl>0], na.rm=T), 0), length(data$id[data$party=="Scottish National Party"]),  length(unique(data$id[data$party=="Scottish National Party"]))),
	c("Years in Parliament", "", "", "", ""),
	c("5 or less", round(mean(data$earnings.all.infl[data$office.years<=5]>0, na.rm=T), 3), round(mean(data$earnings.all.infl[data$office.years<=5 & data$earnings.all.infl>0], na.rm=T), 0), length(data$id[data$office.years<=5]),  length(unique(data$id[data$office.years<=5]))),
	c("6-10", round(mean(data$earnings.all.infl[data$office.years>5 & data$office.years<=10]>0, na.rm=T), 3), round(mean(data$earnings.all.infl[data$office.years>5 & data$office.years<=10 & data$earnings.all.infl>0], na.rm=T), 0), length(data$id[data$office.years>5 & data$office.years<=10]),  length(unique(data$id[data$office.years>5 & data$office.years<=10]))),
	c("11-15", round(mean(data$earnings.all.infl[data$office.years>10 & data$office.years<=15]>0, na.rm=T), 3), round(mean(data$earnings.all.infl[data$office.years>10 & data$office.years<=15 & data$earnings.all.infl>0], na.rm=T), 0), length(data$id[data$office.years>10 & data$office.years<=15]),  length(unique(data$id[data$office.years>10 & data$office.years<=15]))),
	c("more than 15", round(mean(data$earnings.all.infl[data$office.years>15]>0, na.rm=T), 3), round(mean(data$earnings.all.infl[data$office.years>15 & data$earnings.all.infl>0], na.rm=T), 0), length(data$id[data$office.years>15]),  length(unique(data$id[data$office.years>15]))),
	c("Educational Background", "", "", "", ""),
	c("Oxbridge", round(mean(data$earnings.all.infl[data$oxbridge==1]>0, na.rm=T), 3), round(mean(data$earnings.all.infl[data$oxbridge==1 & data$earnings.all.infl>0], na.rm=T), 0), length(data$id[data$oxbridge==1]),  length(unique(data$id[data$oxbridge==1]))),
	c("Other University", round(mean(data$earnings.all.infl[data$oxbridge==0 & data$nouni==0]>0, na.rm=T), 3), round(mean(data$earnings.all.infl[data$oxbridge==0 & data$nouni==0 & data$earnings.all.infl>0], na.rm=T), 0), length(data$id[data$oxbridge==0 & data$nouni==0]),  length(unique(data$id[data$oxbridge==0 & data$nouni==0]))),
	c("No University", round(mean(data$earnings.all.infl[data$nouni==1]>0, na.rm=T), 3), round(mean(data$earnings.all.infl[data$nouni==1 & data$earnings.all.infl>0], na.rm=T), 0), length(data$id[data$nouni==1]),  length(unique(data$id[data$nouni==1])))
)

colnames(outtab) <- c("", "Share with Earnings", "Mean Job Earnings", "MP-Years", "MPs")

outtable <- xtable(outtab)
print(outtable, file="output/appendix/tab_a2.tex")




# Tab A3
outtab <- rbind(
	t(rbind("Conservative", dim(data[data$party=="Conservative",])[1], length(unique(data$id[data$party=="Conservative"])))),
	t(rbind("Labour, Labour/Co-Operative, Social Democratic/Labour", dim(data[data$party=="Labour" | data$party=="Labour/Co-operative" | data$party=="Social Democratic and Labour Party",])[1], length(unique(data$id[data$party=="Labour" | data$party=="Labour/Co-operative" | data$party=="Social Democratic and Labour Party"])))),
	t(rbind("Liberal Democrat", dim(data[data$party=="Liberal Democrat",])[1], length(unique(data$id[data$party=="Liberal Democrat"])))),
	t(rbind("Scottish National Party", dim(data[data$party=="Scottish National Party",])[1], length(unique(data$id[data$party=="Scottish National Party"])))),
	t(rbind("DUP", dim(data[data$party=="DUP",])[1], length(unique(data$id[data$party=="DUP"])))),
	t(rbind("Plaid Cymru", dim(data[data$party=="Plaid Cymru",])[1], length(unique(data$id[data$party=="Plaid Cymru"])))),
	t(rbind("UKIP", dim(data[data$party=="UKIP",])[1], length(unique(data$id[data$party=="UKIP"])))),
	t(rbind("Green", dim(data[data$party=="Green",])[1], length(unique(data$id[data$party=="Green"])))),
	t(rbind("Alliance", dim(data[data$party=="Alliance",])[1], length(unique(data$id[data$party=="Alliance"])))),
	t(rbind("Respect", dim(data[data$party=="Respect",])[1], length(unique(data$id[data$party=="Respect"])))),
	t(rbind("UUP", dim(data[data$party=="UUP",])[1], length(unique(data$id[data$party=="UUP"])))),
	t(rbind("Independent", dim(data[data$party=="Independent",])[1], length(unique(data$id[data$party=="Independent"])))),
	t(rbind("Total", dim(data)[1], length(unique(data$id))))
					)
colnames(outtab) <- c("Party", "MP-Years", "MPs")

outtable <- xtable(outtab, digits=3)
print(outtable, file="output/appendix/tab_a3.tex")









### SECTION C: Regression Results without Legislator Fixed Effects

data$party.cons <- ifelse(data$party=="Conservative", 1, 0)
data$party.lab <- ifelse(data$party=="Labour" | data$party=="Labour/Co-operative" | data$party=="Social Democratic and Labour Party", 1, 0)

mC1 <- felm(earnings.all.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave + gender + office.years + party.cons + party.lab + oxbridge + nouni | year | 0 | id, data=data)

mC2 <- felm(earnings.work.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave + gender + office.years + party.cons + party.lab + oxbridge + nouni | year | 0 | id, data=data)

mC3 <- felm(earnings.press.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave + gender + office.years + party.cons + party.lab + oxbridge + nouni | year | 0 | id, data=data)

mC4 <- felm(earnings.speech.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave + gender + office.years + party.cons + party.lab + oxbridge + nouni | year | 0 | id, data=data)


stargazer(mC1, mC2, mC3, mC4,
	dep.var.labels=c("Earnings, Total", "Earnings, Work", "Earnings, Press", "Earnings, Speeches"),
	covariate.labels=c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member", "Post-Minister", "Post-Minister of State", "Post-Parliamentary Secretary", "Post-Shadow Cabinet", "Post-Frontbench Team", "Post-Committee Chair", "Post-Committee Member", "Enter Office", "Leave Office", "Gender: Male", "Years in Office", "Party: Conservative", "Party: Labour", "Education: Oxbridge", "Education: No University"), 
	no.space=T,
	out="output/appendix/tab_a4.tex")







### SECTION D: Regression Checks




### D.1 Alternative DVs

data$earnings.all.infl.bin <- ifelse(data$earnings.all.infl.log.1>0, 1, 0)

# + 10
mD11 <- felm(earnings.all.infl.log.10 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)

# + 100
mD12 <- felm(earnings.all.infl.log.100 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)

# + 1000
mD13 <- felm(earnings.all.infl.log.1000 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)

# binary
mD14 <- felm(earnings.all.infl.bin ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)

stargazer(mD11, mD12, mD13, mD14,
	dep.var.labels=c("log(Earnings+10)", "log(Earnings+100)", "log(Earnings+1000)", "Binary: Any Earnings"),
	covariate.labels=c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member", "Post-Minister", "Post-Minister of State", "Post-Parliamentary Secretary", "Post-Shadow Cabinet", "Post-Frontbench Team", "Post-Committee Chair", "Post-Committee Member", "Enter Office", "Leave Office"), 
	no.space=T,
	out="output/appendix/tab_a5.tex")





### D.2 Leaving Out MPs Who Do Not Hold Any Parliamentary Position

data$jobtot <- data$minister + data$minister.state + data$undersec + data$shadow.cabinet + data$frontbench.team + data$com.chair + data$com.member

bla <- aggregate(data$jobtot, by=list(id=data$id), FUN=sum)
nojob <- bla$id[bla$x==0]
withjob <- setdiff(unique(data$id), nojob)


# all
m1 <- felm(earnings.all.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data[data$id %in% withjob,])
summary(m1)

# work
m2 <- felm(earnings.work.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data[data$id %in% withjob,])
summary(m2)

# press
m3 <- felm(earnings.press.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data[data$id %in% withjob,])
summary(m3)

# speech
m4 <- felm(earnings.speech.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data[data$id %in% withjob,])
summary(m4)


stargazer(m1, m2, m3, m4,
	dep.var.labels=c("Logged Earnings Total", "Logged Earnings Regular Employment", "Logged Earnings Press", "Logged Earnings Speeches"),
	covariate.labels=c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member", "Post-Minister", "Post-Minister of State", "Post-Parliamentary Secretary", "Post-Shadow Cabinet", "Post-Frontbench Team", "Post-Committee Chair", "Post-Committee Member", "Enter Office", "Leave Office"), 
	no.space=T,
	out="output/appendix/tab_a6.tex")

length(unique(m1$fe[[2]]))
length(unique(m2$fe[[2]]))
length(unique(m3$fe[[2]]))
length(unique(m4$fe[[2]]))




### D.3 More Flexible Year-Fixed Effects Specifications

## A7: by gender
data$year_M <- ifelse(data$gender=="male", data$year, 0)
data$year_F <- ifelse(data$gender=="female", data$year, 0)


# all
m1 <- felm(earnings.all.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_M + year_F + id | 0 | id, data=data)
summary(m1)

# work
m2 <- felm(earnings.work.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_M + year_F + id | 0 | id, data=data)
summary(m2)

# press
m3 <- felm(earnings.press.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_M + year_F + id | 0 | id, data=data)
summary(m3)

# speech
m4 <- felm(earnings.speech.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_M + year_F + id | 0 | id, data=data)
summary(m4)


stargazer(m1, m2, m3, m4,
	dep.var.labels=c("Logged Earnings Total", "Logged Earnings Regular Employment", "Logged Earnings Press", "Logged Earnings Speeches"),
	covariate.labels=c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member", "Post-Minister", "Post-Minister of State", "Post-Parliamentary Secretary", "Post-Shadow Cabinet", "Post-Frontbench Team", "Post-Committee Chair", "Post-Committee Member", "Enter Office", "Leave Office"), 
	no.space=T,
	out="output/appendix/tab_a7.tex")

length(unique(m1$fe[[3]]))
length(unique(m2$fe[[3]]))
length(unique(m3$fe[[3]]))
length(unique(m4$fe[[3]]))



## A8: by party
data$year_C <- ifelse(data$party=="Conservative", data$year, 0)
data$year_L <- ifelse(data$party=="Labour" | data$party=="Labour/Co-operative" | data$party=="Social Democratic and Labour Party", data$year, 0)
data$year_O <- ifelse(data$party!="Conservative" & data$party!="Labour" & data$party!="Labour/Co-operative" & data$party!="Social Democratic and Labour Party", data$year, 0)


# all
m1 <- felm(earnings.all.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_C + year_L + year_O + id | 0 | id, data=data)
summary(m1)

# work
m2 <- felm(earnings.work.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_C + year_L + year_O + id | 0 | id, data=data)
summary(m2)

# press
m3 <- felm(earnings.press.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_C + year_L + year_O + id | 0 | id, data=data)
summary(m3)

# speech
m4 <- felm(earnings.speech.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_C + year_L + year_O + id | 0 | id, data=data)
summary(m4)

stargazer(m1, m2, m3, m4,
	dep.var.labels=c("Logged Earnings Total", "Logged Earnings Regular Employment", "Logged Earnings Press", "Logged Earnings Speeches"),
	covariate.labels=c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member", "Post-Minister", "Post-Minister of State", "Post-Parliamentary Secretary", "Post-Shadow Cabinet", "Post-Frontbench Team", "Post-Committee Chair", "Post-Committee Member", "Enter Office", "Leave Office"), 
	no.space=T,
	out="output/appendix/tab_a8.tex")

length(unique(m1$fe[[4]]))
length(unique(m2$fe[[4]]))
length(unique(m3$fe[[4]]))
length(unique(m4$fe[[4]]))



## A9: by years in parliament
data$year_5 <- ifelse(data$office.years<=5, data$year, 0)
data$year_10 <- ifelse(data$office.years>5 & data$office.years<=10, data$year, 0)
data$year_15 <- ifelse(data$office.years>10 & data$office.years<=15, data$year, 0)
data$year_M <- ifelse(data$office.years>15, data$year, 0)


# all
m1 <- felm(earnings.all.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_5 + year_10 + year_15 + year_M + id | 0 | id, data=data)
summary(m1)

# work
m2 <- felm(earnings.work.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_5 + year_10 + year_15 + year_M + id | 0 | id, data=data)
summary(m2)

# press
m3 <- felm(earnings.press.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_5 + year_10 + year_15 + year_M + id | 0 | id, data=data)
summary(m3)

# speech
m4 <- felm(earnings.speech.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_5 + year_10 + year_15 + year_M + id | 0 | id, data=data)
summary(m4)


stargazer(m1, m2, m3, m4,
	dep.var.labels=c("Logged Earnings Total", "Logged Earnings Regular Employment", "Logged Earnings Press", "Logged Earnings Speeches"),
	covariate.labels=c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member", "Post-Minister", "Post-Minister of State", "Post-Parliamentary Secretary", "Post-Shadow Cabinet", "Post-Frontbench Team", "Post-Committee Chair", "Post-Committee Member", "Enter Office", "Leave Office"), 
	no.space=T,
	out="output/appendix/tab_a9.tex")

length(unique(m1$fe[[5]]))
length(unique(m2$fe[[5]]))
length(unique(m3$fe[[5]]))
length(unique(m4$fe[[5]]))



## A10: by education
data$year_O <- ifelse(data$oxbridge==1, data$year, 0)
data$year_U <- ifelse(data$oxbridge==0 & data$nouni==0, data$year, 0)
data$year_N <- ifelse(data$nouni==1, data$year, 0)


# all
m1 <- felm(earnings.all.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_O + year_U + year_N + id | 0 | id, data=data)
summary(m1)

# work
m2 <- felm(earnings.work.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_O + year_U + year_N + id | 0 | id, data=data)
summary(m2)

# press
m3 <- felm(earnings.press.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_O + year_U + year_N + id | 0 | id, data=data)
summary(m3)

# speech
m4 <- felm(earnings.speech.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year_O + year_U + year_N + id | 0 | id, data=data)
summary(m4)


stargazer(m1, m2, m3, m4,
	dep.var.labels=c("Logged Earnings Total", "Logged Earnings Regular Employment", "Logged Earnings Press", "Logged Earnings Speeches"),
	covariate.labels=c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member", "Post-Minister", "Post-Minister of State", "Post-Parliamentary Secretary", "Post-Shadow Cabinet", "Post-Frontbench Team", "Post-Committee Chair", "Post-Committee Member", "Enter Office", "Leave Office"), 
	no.space=T,
	out="output/appendix/tab_a10.tex")

length(unique(m1$fe[[4]]))
length(unique(m2$fe[[4]]))
length(unique(m3$fe[[4]]))
length(unique(m4$fe[[4]]))






### D.4: Weighted Fixed Effects Estimates

varvec <- c("minister", "minister.state", "undersec", "shadow.cabinet", "frontbench.team", "com.chair", "com.member", "minister.post", "minister.state.post", "undersec.post", "shadow.cabinet.post", "frontbench.team.post", "com.chair.post", "com.member.post")

data1 <- NULL
for(i in 1:length(varvec)){
	m <- wfe(as.formula(paste0("earnings.all.infl.log.1 ~ ", varvec[i], " + enter + leave")), treat = varvec[i], data=data, unit.index="id", time.index = "year", method = "unit", qoi = "ate", estimator = "did", hetero.se=TRUE, auto.se=TRUE, unweighted=F)
	add <- data.frame(varvec[i], m$coefficients[1], m$coefficients[1]+qnorm(0.025)*sqrt(m$vcov[1]), m$coefficients[1]+qnorm(0.975)*sqrt(m$vcov[1]))
	data1 <- rbind(data1, add)
}
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")



data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a2.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(-6,4), ylim=c(1-0.2,length(data.cur$coef)+0.2), yaxt="n", ylab="", xlab="WFE DiD Estimate (Separate Models)")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()









### D.5 Jackknife Estimates

morig <- felm(earnings.all.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)


ids <- unique(data$id)

outdata <- NULL
for(i in 1:length(ids)){
	m <- felm(earnings.all.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data[data$id!=ids[i],])
	add <- data.frame(rownames(m$coefficients), ids[i], m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
	outdata <- rbind(outdata, add)
}

colnames(outdata) <- c("var", "id", "coef", "ci_lower", "ci_upper")


# minister
useids <- unique(data$id[data$minister==1])
usedata <- outdata[outdata$var=="minister" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a3.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="minister"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=1)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=1)
}
dev.off()


# minister.state
useids <- unique(data$id[data$minister.state==1])
usedata <- outdata[outdata$var=="minister.state" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a4.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="minister.state"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=1)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=1)
}
dev.off()


# undersec
useids <- unique(data$id[data$undersec==1])
usedata <- outdata[outdata$var=="undersec" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a5.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="undersec"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=1)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=1)
}
dev.off()


# shadow.cabinet
useids <- unique(data$id[data$shadow.cabinet==1])
usedata <- outdata[outdata$var=="shadow.cabinet" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a6.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="shadow.cabinet"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=0.4)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=0.25)
}
dev.off()


# frontbench.team
useids <- unique(data$id[data$frontbench.team==1])
usedata <- outdata[outdata$var=="frontbench.team" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a7.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="frontbench.team"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=1)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=1)
}
dev.off()


# com.chair
useids <- unique(data$id[data$com.chair==1])
usedata <- outdata[outdata$var=="com.chair" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a8.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="com.chair"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=1)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=1)
}
dev.off()


# com.member
useids <- unique(data$id[data$com.member==1])
usedata <- outdata[outdata$var=="com.member" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a9.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="com.member"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=0.3)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=0.05)
}
dev.off()


# minister.post
useids <- unique(data$id[data$minister.post==1])
usedata <- outdata[outdata$var=="minister.post" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a10.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="minister.post"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=1)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=1)
}
dev.off()


# minister.state.post
useids <- unique(data$id[data$minister.state.post==1])
usedata <- outdata[outdata$var=="minister.state.post" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a11.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="minister.state.post"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=1)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=1)
}
dev.off()


# undersec.post
useids <- unique(data$id[data$undersec.post==1])
usedata <- outdata[outdata$var=="undersec.post" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a12.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="undersec.post"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=1)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=1)
}
dev.off()


# shadow.cabinet.post
useids <- unique(data$id[data$shadow.cabinet.post==1])
usedata <- outdata[outdata$var=="shadow.cabinet.post" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a13.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="shadow.cabinet.post"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=0.4)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=0.25)
}
dev.off()


# frontbench.team.post
useids <- unique(data$id[data$frontbench.team.post==1])
usedata <- outdata[outdata$var=="frontbench.team.post" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a14.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="frontbench.team.post"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=1)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=1)
}
dev.off()


# com.chair.post
useids <- unique(data$id[data$com.chair.post==1])
usedata <- outdata[outdata$var=="com.chair.post" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a15.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="com.chair.post"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=1)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=1)
}
dev.off()


# com.member.post
useids <- unique(data$id[data$com.member.post==1])
usedata <- outdata[outdata$var=="com.member.post" & outdata$id %in% useids,]

pdf(width=5*1.62, height=5, file="output/appendix/fig_a16.pdf")
par(mar = c(4,4,1,1), mgp=c(3,1,0))
plot(1:dim(usedata)[1], usedata$coef, ylim=c(min(0, min(usedata$ci_lower)), max(0, max(usedata$ci_upper))), type="n", xlab="MP Left Out", ylab="Jackknife Regression Coefficients")
abline(h=0, col="gray", lwd=2)
abline(h=morig$coefficients[rownames(morig$coefficients)=="com.member.post"], col="red", lwd=2)
points(1:dim(usedata)[1], usedata$coef, pch=16, cex=0.4)
for(i in 1:dim(usedata)[1]){
	lines(c(i,i), c(usedata$ci_lower[i], usedata$ci_upper[i]), lwd=0.15)
}
dev.off()






### D.6: Leads and Lags of Position Change

data$minister.lead.2 <- ifelse(data$minister.notyears==-2, 1, 0)
data$minister.lead.1 <- ifelse(data$minister.notyears==-1, 1, 0)
data$minister.lag.1 <- ifelse(data$minister.years==1, 1, 0)
data$minister.lag.2 <- ifelse(data$minister.years==2, 1, 0)
data$minister.lag.3 <- ifelse(data$minister.years==3, 1, 0)

data$minister.state.lead.2 <- ifelse(data$minister.state.notyears==-2, 1, 0)
data$minister.state.lead.1 <- ifelse(data$minister.state.notyears==-1, 1, 0)
data$minister.state.lag.1 <- ifelse(data$minister.state.years==1, 1, 0)
data$minister.state.lag.2 <- ifelse(data$minister.state.years==2, 1, 0)
data$minister.state.lag.3 <- ifelse(data$minister.state.years==3, 1, 0)

data$undersec.lead.2 <- ifelse(data$undersec.notyears==-2, 1, 0)
data$undersec.lead.1 <- ifelse(data$undersec.notyears==-1, 1, 0)
data$undersec.lag.1 <- ifelse(data$undersec.years==1, 1, 0)
data$undersec.lag.2 <- ifelse(data$undersec.years==2, 1, 0)
data$undersec.lag.3 <- ifelse(data$undersec.years==3, 1, 0)

data$shadow.cabinet.lead.2 <- ifelse(data$shadow.cabinet.notyears==-2, 1, 0)
data$shadow.cabinet.lead.1 <- ifelse(data$shadow.cabinet.notyears==-1, 1, 0)
data$shadow.cabinet.lag.1 <- ifelse(data$shadow.cabinet.years==1, 1, 0)
data$shadow.cabinet.lag.2 <- ifelse(data$shadow.cabinet.years==2, 1, 0)
data$shadow.cabinet.lag.3 <- ifelse(data$shadow.cabinet.years==3, 1, 0)

data$frontbench.team.lead.2 <- ifelse(data$frontbench.team.notyears==-2, 1, 0)
data$frontbench.team.lead.1 <- ifelse(data$frontbench.team.notyears==-1, 1, 0)
data$frontbench.team.lag.1 <- ifelse(data$frontbench.team.years==1, 1, 0)
data$frontbench.team.lag.2 <- ifelse(data$frontbench.team.years==2, 1, 0)
data$frontbench.team.lag.3 <- ifelse(data$frontbench.team.years==3, 1, 0)

data$com.chair.lead.2 <- ifelse(data$com.chair.notyears==-2, 1, 0)
data$com.chair.lead.1 <- ifelse(data$com.chair.notyears==-1, 1, 0)
data$com.chair.lag.1 <- ifelse(data$com.chair.years==1, 1, 0)
data$com.chair.lag.2 <- ifelse(data$com.chair.years==2, 1, 0)
data$com.chair.lag.3 <- ifelse(data$com.chair.years==3, 1, 0)

data$com.member.lead.2 <- ifelse(data$com.member.notyears==-2, 1, 0)
data$com.member.lead.1 <- ifelse(data$com.member.notyears==-1, 1, 0)
data$com.member.lag.1 <- ifelse(data$com.member.years==1, 1, 0)
data$com.member.lag.2 <- ifelse(data$com.member.years==2, 1, 0)
data$com.member.lag.3 <- ifelse(data$com.member.years==3, 1, 0)


data$minister.post.lead.3 <- ifelse(data$minister.yearstoend==-3, 1, 0)
data$minister.post.lead.2 <- ifelse(data$minister.yearstoend==-2, 1, 0)
data$minister.post.lead.1 <- ifelse(data$minister.yearstoend==-1, 1, 0)
data$minister.post.lag.1 <- ifelse(data$minister.notyears==1, 1, 0)
data$minister.post.lag.2 <- ifelse(data$minister.notyears==2, 1, 0)

data$minister.state.post.lead.3 <- ifelse(data$minister.state.yearstoend==-3, 1, 0)
data$minister.state.post.lead.2 <- ifelse(data$minister.state.yearstoend==-2, 1, 0)
data$minister.state.post.lead.1 <- ifelse(data$minister.state.yearstoend==-1, 1, 0)
data$minister.state.post.lag.1 <- ifelse(data$minister.state.notyears==1, 1, 0)
data$minister.state.post.lag.2 <- ifelse(data$minister.state.notyears==2, 1, 0)

data$undersec.post.lead.3 <- ifelse(data$undersec.yearstoend==-3, 1, 0)
data$undersec.post.lead.2 <- ifelse(data$undersec.yearstoend==-2, 1, 0)
data$undersec.post.lead.1 <- ifelse(data$undersec.yearstoend==-1, 1, 0)
data$undersec.post.lag.1 <- ifelse(data$undersec.notyears==1, 1, 0)
data$undersec.post.lag.2 <- ifelse(data$undersec.notyears==2, 1, 0)

data$shadow.cabinet.post.lead.3 <- ifelse(data$shadow.cabinet.yearstoend==-3, 1, 0)
data$shadow.cabinet.post.lead.2 <- ifelse(data$shadow.cabinet.yearstoend==-2, 1, 0)
data$shadow.cabinet.post.lead.1 <- ifelse(data$shadow.cabinet.yearstoend==-1, 1, 0)
data$shadow.cabinet.post.lag.1 <- ifelse(data$shadow.cabinet.notyears==1, 1, 0)
data$shadow.cabinet.post.lag.2 <- ifelse(data$shadow.cabinet.notyears==2, 1, 0)

data$frontbench.team.post.lead.3 <- ifelse(data$frontbench.team.yearstoend==-3, 1, 0)
data$frontbench.team.post.lead.2 <- ifelse(data$frontbench.team.yearstoend==-2, 1, 0)
data$frontbench.team.post.lead.1 <- ifelse(data$frontbench.team.yearstoend==-1, 1, 0)
data$frontbench.team.post.lag.1 <- ifelse(data$frontbench.team.notyears==1, 1, 0)
data$frontbench.team.post.lag.2 <- ifelse(data$frontbench.team.notyears==2, 1, 0)

data$com.chair.post.lead.3 <- ifelse(data$com.chair.yearstoend==-3, 1, 0)
data$com.chair.post.lead.2 <- ifelse(data$com.chair.yearstoend==-2, 1, 0)
data$com.chair.post.lead.1 <- ifelse(data$com.chair.yearstoend==-1, 1, 0)
data$com.chair.post.lag.1 <- ifelse(data$com.chair.notyears==1, 1, 0)
data$com.chair.post.lag.2 <- ifelse(data$com.chair.notyears==2, 1, 0)

data$com.member.post.lead.3 <- ifelse(data$com.member.yearstoend==-3, 1, 0)
data$com.member.post.lead.2 <- ifelse(data$com.member.yearstoend==-2, 1, 0)
data$com.member.post.lead.1 <- ifelse(data$com.member.yearstoend==-1, 1, 0)
data$com.member.post.lag.1 <- ifelse(data$com.member.notyears==1, 1, 0)
data$com.member.post.lag.2 <- ifelse(data$com.member.notyears==2, 1, 0)


m31 <- m <- felm(earnings.all.infl.log.1 ~ minister.lead.2 + minister.lead.1 + minister.lag.1 + minister.lag.2 + minister.lag.3 + minister.state.lead.2 + minister.state.lead.1 + minister.state.lag.1 + minister.state.lag.2 + minister.state.lag.3 + undersec.lead.2 + undersec.lead.1 + undersec.lag.1 + undersec.lag.2 + undersec.lag.3 + shadow.cabinet.lead.2 + shadow.cabinet.lead.1 + shadow.cabinet.lag.1 + shadow.cabinet.lag.2 + shadow.cabinet.lag.3 + frontbench.team.lead.2 + frontbench.team.lead.1 + frontbench.team.lag.1 + frontbench.team.lag.2 + frontbench.team.lag.3 + com.chair.lead.2 + com.chair.lead.1 + com.chair.lag.1 + com.chair.lag.2 + com.chair.lag.3 + com.member.lead.2 + com.member.lead.1 + com.member.lag.1 + com.member.lag.2 + com.member.lag.3 + minister.post.lead.3 + minister.post.lead.2 + minister.post.lead.1 + minister.post.lag.1 + minister.post.lag.2 + minister.state.post.lead.3 + minister.state.post.lead.2 + minister.state.post.lead.1 + minister.state.post.lag.1 + minister.state.post.lag.2 + undersec.post.lead.3 + undersec.post.lead.2 + undersec.post.lead.1 + undersec.post.lag.1 + undersec.post.lag.2 + shadow.cabinet.post.lead.3 + shadow.cabinet.post.lead.2 + shadow.cabinet.post.lead.1 + shadow.cabinet.post.lag.1 + shadow.cabinet.post.lag.2 + frontbench.team.post.lead.3 + frontbench.team.post.lead.2 + frontbench.team.post.lead.1 + frontbench.team.post.lag.1 + frontbench.team.post.lag.2 + com.chair.post.lead.3 + com.chair.post.lead.2 + com.chair.post.lead.1 + com.chair.post.lag.1 + com.chair.post.lag.2 + com.member.post.lead.3 + com.member.post.lead.2 + com.member.post.lead.1 + com.member.post.lag.1 + com.member.post.lag.2 + enter + leave | year + id | 0 | id, data=data)
summary(m31)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
data1 <- data1[1:70,]
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")
data1 <- data1[rev(rownames(data1)),]




pdf(width=5*1.62, height=10, file="output/appendix/fig_a17.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data1$coef[1:7], c(1:7), type="n", xlim=c(min(data1$ci_lower), max(data1$ci_upper)), ylim=c(1-0.5,7+0.5), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:7), rev(c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")), cex.axis=0.75, las=2)
abline(v=0, col="lightgrey", lwd=3)
abline(h=c(1:length(data1$coef)), col="lightgrey", lwd=1)


usedata <- data1[grep("lag.3", data1$var),]
points(usedata$coef, c(1:7)-0.2, pch=16, cex=1.25)
for(i in 1:(length(usedata$coef))){
	lines(c(usedata$ci_lower[i], usedata$ci_upper[i]), c(i-0.2,i-0.2), lwd=1.75)
}
text(usedata$ci_upper[7]+0.15, 7-0.2, "+2", cex=0.8)

usedata <- data1[grep("lag.2", data1$var),]
usedata <- usedata[-grep("post", usedata$var),]
points(usedata$coef, c(1:7)-0.1, pch=16, cex=1.25)
for(i in 1:(length(usedata$coef))){
	lines(c(usedata$ci_lower[i], usedata$ci_upper[i]), c(i-0.1,i-0.1), lwd=1.75)
}
text(usedata$ci_upper[7]+0.15, 7-0.1, "+1", cex=0.8)

usedata <- data1[grep("lag.1", data1$var),]
usedata <- usedata[-grep("post", usedata$var),]
points(usedata$coef, c(1:7), pch=16, cex=1.25)
for(i in 1:(length(usedata$coef))){
	lines(c(usedata$ci_lower[i], usedata$ci_upper[i]), c(i,i), lwd=1.75)
}
text(usedata$ci_lower[7]-0.15, 7, "0", cex=0.8)

usedata <- data1[grep("lead.1", data1$var),]
usedata <- usedata[-grep("post", usedata$var),]
points(usedata$coef, c(1:7)+0.1, pch=16, cex=1.25)
for(i in 1:(length(usedata$coef))){
	lines(c(usedata$ci_lower[i], usedata$ci_upper[i]), c(i+0.1,i+0.1), lwd=1.75)
}
text(usedata$ci_lower[7]-0.15, 7+0.1, "-1", cex=0.8)

usedata <- data1[grep("lead.2", data1$var),]
usedata <- usedata[-grep("post", usedata$var),]
points(usedata$coef, c(1:7)+0.2, pch=16, cex=1.25)
for(i in 1:(length(usedata$coef))){
	lines(c(usedata$ci_lower[i], usedata$ci_upper[i]), c(i+0.2,i+0.2), lwd=1.75)
}
text(usedata$ci_lower[7]-0.15, 7+0.2, "-2", cex=0.8)

dev.off()



pdf(width=5*1.62, height=10, file="output/appendix/fig_a18.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data1$coef[1:7], c(1:7), type="n", xlim=c(min(data1$ci_lower), max(data1$ci_upper)), ylim=c(1-0.5,7+0.5), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:7), rev(c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")), cex.axis=0.75, las=2)
abline(v=0, col="lightgrey", lwd=3)
abline(h=c(1:length(data1$coef)), col="lightgrey", lwd=1)


usedata <- data1[grep("post.lag.2", data1$var),]
points(usedata$coef, c(1:7)-0.2, pch=16, cex=1.25, col="darkgray")
for(i in 1:(length(usedata$coef))){
	lines(c(usedata$ci_lower[i], usedata$ci_upper[i]), c(i-0.2,i-0.2), lwd=1.75, col="darkgray")
}
text(usedata$ci_upper[7]+0.15, 7-0.2, "+2", cex=0.8, col="darkgray")

usedata <- data1[grep("post.lag.1", data1$var),]
points(usedata$coef, c(1:7)-0.1, pch=16, cex=1.25, col="darkgray")
for(i in 1:(length(usedata$coef))){
	lines(c(usedata$ci_lower[i], usedata$ci_upper[i]), c(i-0.1,i-0.1), lwd=1.75, col="darkgray")
}
text(usedata$ci_upper[7]+0.15, 7-0.1, "+1", cex=0.8, col="darkgray")

usedata <- data1[grep("post.lead.1", data1$var),]
points(usedata$coef, c(1:7), pch=16, cex=1.25, col="darkgray")
for(i in 1:(length(usedata$coef))){
	lines(c(usedata$ci_lower[i], usedata$ci_upper[i]), c(i,i), lwd=1.75, col="darkgray")
}
text(usedata$ci_lower[7]-0.15, 7, "0", cex=0.8, col="darkgray")

usedata <- data1[grep("post.lead.2", data1$var),]
points(usedata$coef, c(1:7)+0.1, pch=16, cex=1.25, col="darkgray")
for(i in 1:(length(usedata$coef))){
	lines(c(usedata$ci_lower[i], usedata$ci_upper[i]), c(i+0.1,i+0.1), lwd=1.75, col="darkgray")
}
text(usedata$ci_lower[7]-0.15, 7+0.1, "-1", cex=0.8, col="darkgray")

usedata <- data1[grep("post.lead.3", data1$var),]
points(usedata$coef, c(1:7)+0.2, pch=16, cex=1.25, col="darkgray")
for(i in 1:(length(usedata$coef))){
	lines(c(usedata$ci_lower[i], usedata$ci_upper[i]), c(i+0.2,i+0.2), lwd=1.75, col="darkgray")
}
text(usedata$ci_lower[7]-0.15, 7+0.2, "-2", cex=0.8, col="darkgray")

dev.off()





### E1: Testing for Negligible Effect Size

# first, compute average private sector income before taking any position, and compute what that means for coefficient we need to get to see increase of 18500 in earnings

# minister
ids <- unique(data$id[data$minister==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$minister==0 & mindata$minister.post==0,]
meanbefore.minister <- meanbefore <- mean(beforedata$earnings.all.infl)

meanbefore.log <- log(meanbefore+1)
target.log <- log(18500+meanbefore+1)
target.minister <- target.log - meanbefore.log


# minister.state
ids <- unique(data$id[data$minister.state==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$minister.state==0 & mindata$minister.state.post==0,]
meanbefore.minister.state<- meanbefore <- mean(beforedata$earnings.all.infl)

meanbefore.log <- log(meanbefore+1)
target.log <- log(18500+meanbefore+1)
target.minister.state <- target.log - meanbefore.log

# undersec
ids <- unique(data$id[data$undersec==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$undersec==0 & mindata$undersec.post==0,]
meanbefore.undersec <- meanbefore <- mean(beforedata$earnings.all.infl)

meanbefore.log <- log(meanbefore+1)
target.log <- log(18500+meanbefore+1)
target.undersec <- target.log - meanbefore.log

# shadow.cabinet
ids <- unique(data$id[data$shadow.cabinet==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$shadow.cabinet==0 & mindata$shadow.cabinet.post==0,]
meanbefore.shadow.cabinet <- meanbefore <- mean(beforedata$earnings.all.infl)

meanbefore.log <- log(meanbefore+1)
target.log <- log(18500+meanbefore+1)
target.shadow.cabinet <- target.log - meanbefore.log

# frontbench.team
ids <- unique(data$id[data$frontbench.team==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$frontbench.team==0 & mindata$frontbench.team.post==0,]
meanbefore.frontbench.team <- meanbefore <- mean(beforedata$earnings.all.infl)


meanbefore.log <- log(meanbefore+1)
target.log <- log(18500+meanbefore+1)
target.frontbench.team <- target.log - meanbefore.log

# com.chair
ids <- unique(data$id[data$com.chair==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$com.chair==0 & mindata$com.chair.post==0,]
meanbefore.com.chair <- meanbefore <- mean(beforedata$earnings.all.infl)

meanbefore.log <- log(meanbefore+1)
target.log <- log(18500+meanbefore+1)
target.com.chair <- target.log - meanbefore.log

# com.member
ids <- unique(data$id[data$com.member==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$com.member==0 & mindata$com.member.post==0,]
meanbefore.com.member <- meanbefore <- mean(beforedata$earnings.all.infl)

meanbefore.log <- log(meanbefore+1)
target.log <- log(18500+meanbefore+1)
target.com.member <- target.log - meanbefore.log

targets <- c(target.minister, target.minister.state, target.undersec, target.shadow.cabinet, target.frontbench.team, target.com.chair, target.com.member)
targets <- rev(targets)



# Figure A19
m1 <- m <- felm(earnings.all.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.05)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.95)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]


# compute the largest effect we cannot reject for each
meandiff.current <- meandiff.post <- NULL

# minister
ids <- unique(data$id[data$minister==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$minister==0 & mindata$minister.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="minister"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="minister.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# minister.state
ids <- unique(data$id[data$minister.state==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$minister.state==0 & mindata$minister.state.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="minister.state"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="minister.state.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# undersec
ids <- unique(data$id[data$undersec==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$undersec==0 & mindata$undersec.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="undersec"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="undersec.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# shadow.cabinet
ids <- unique(data$id[data$shadow.cabinet==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$shadow.cabinet==0 & mindata$shadow.cabinet.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="shadow.cabinet"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="shadow.cabinet.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)


# frontbench.team
ids <- unique(data$id[data$frontbench.team==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$frontbench.team==0 & mindata$frontbench.team.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="frontbench.team"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="frontbench.team.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)


# com.chair
ids <- unique(data$id[data$com.chair==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$com.chair==0 & mindata$com.chair.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="com.chair"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="com.chair.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# com.member
ids <- unique(data$id[data$com.member==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$com.member==0 & mindata$com.member.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="com.member"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="com.member.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

meandiff.current <- round(meandiff.current, 0)
meandiff.current <- rev(meandiff.current)
meandiff.post <- round(meandiff.post, 0)
meandiff.post <- rev(meandiff.post)


# plot
pdf(width=6*1.62, height=6, file="output/appendix/fig_a19.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T)), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T), max(targets)))+0.2), ylim=c(1-0.2,length(data.cur$coef)+0.3), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
	text(data.cur$ci_upper[i], i+0.2, meandiff.current[i], pos=4, cex=0.7)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
	text(data.post$ci_upper[i], i-0.2, meandiff.post[i], pos=4, cex=0.7, col="darkgray")
}

for(i in 1:length(targets)){
	lines(c(targets[i], targets[i]), c(i-0.25,i+0.25), lwd=3)
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()



# Figure A20
m2 <- m <- felm(earnings.work.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.05)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.95)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]



# compute the largest effect we cannot reject for each
meandiff.current <- meandiff.post <- NULL

# minister
ids <- unique(data$id[data$minister==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$minister==0 & mindata$minister.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="minister"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="minister.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# minister.state
ids <- unique(data$id[data$minister.state==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$minister.state==0 & mindata$minister.state.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="minister.state"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="minister.state.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# undersec
ids <- unique(data$id[data$undersec==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$undersec==0 & mindata$undersec.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="undersec"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="undersec.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# shadow.cabinet
ids <- unique(data$id[data$shadow.cabinet==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$shadow.cabinet==0 & mindata$shadow.cabinet.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="shadow.cabinet"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="shadow.cabinet.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)


# frontbench.team
ids <- unique(data$id[data$frontbench.team==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$frontbench.team==0 & mindata$frontbench.team.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="frontbench.team"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="frontbench.team.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)


# com.chair
ids <- unique(data$id[data$com.chair==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$com.chair==0 & mindata$com.chair.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="com.chair"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="com.chair.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# com.member
ids <- unique(data$id[data$com.member==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$com.member==0 & mindata$com.member.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="com.member"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="com.member.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

meandiff.current <- round(meandiff.current, 0)
meandiff.current <- rev(meandiff.current)
meandiff.post <- round(meandiff.post, 0)
meandiff.post <- rev(meandiff.post)


# plot
pdf(width=6*1.62, height=6, file="output/appendix/fig_a20.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T)), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T), max(targets)))+0.2), ylim=c(1-0.2,length(data.cur$coef)+0.3), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
	text(data.cur$ci_upper[i], i+0.2, meandiff.current[i], pos=4, cex=0.7)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
	text(data.post$ci_upper[i], i-0.2, meandiff.post[i], pos=4, cex=0.7, col="darkgray")
}

for(i in 1:length(targets)){
	lines(c(targets[i], targets[i]), c(i-0.25,i+0.25), lwd=3)
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()



# Figure A21
m3 <- m <- felm(earnings.press.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.05)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.95)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]



# compute the largest effect we cannot reject for each
meandiff.current <- meandiff.post <- NULL

# minister
ids <- unique(data$id[data$minister==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$minister==0 & mindata$minister.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="minister"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="minister.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# minister.state
ids <- unique(data$id[data$minister.state==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$minister.state==0 & mindata$minister.state.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="minister.state"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="minister.state.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# undersec
ids <- unique(data$id[data$undersec==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$undersec==0 & mindata$undersec.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="undersec"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="undersec.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# shadow.cabinet
ids <- unique(data$id[data$shadow.cabinet==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$shadow.cabinet==0 & mindata$shadow.cabinet.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="shadow.cabinet"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="shadow.cabinet.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)


# frontbench.team
ids <- unique(data$id[data$frontbench.team==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$frontbench.team==0 & mindata$frontbench.team.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="frontbench.team"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="frontbench.team.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)


# com.chair
ids <- unique(data$id[data$com.chair==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$com.chair==0 & mindata$com.chair.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="com.chair"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="com.chair.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# com.member
ids <- unique(data$id[data$com.member==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$com.member==0 & mindata$com.member.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="com.member"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="com.member.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

meandiff.current <- round(meandiff.current, 0)
meandiff.current <- rev(meandiff.current)
meandiff.post <- round(meandiff.post, 0)
meandiff.post <- rev(meandiff.post)


# plot
pdf(width=6*1.62, height=6, file="output/appendix/fig_a21.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T)), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T), max(targets)))+0.2), ylim=c(1-0.2,length(data.cur$coef)+0.3), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
	text(data.cur$ci_upper[i], i+0.2, meandiff.current[i], pos=4, cex=0.7)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
	text(data.post$ci_upper[i], i-0.2, meandiff.post[i], pos=4, cex=0.7, col="darkgray")
}

for(i in 1:length(targets)){
	lines(c(targets[i], targets[i]), c(i-0.25,i+0.25), lwd=3)
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()



# Figure A22
m4 <- m <- felm(earnings.speech.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.05)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.95)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]



# compute the largest effect we cannot reject for each
meandiff.current <- meandiff.post <- NULL

# minister
ids <- unique(data$id[data$minister==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$minister==0 & mindata$minister.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="minister"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="minister.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# minister.state
ids <- unique(data$id[data$minister.state==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$minister.state==0 & mindata$minister.state.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="minister.state"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="minister.state.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# undersec
ids <- unique(data$id[data$undersec==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$undersec==0 & mindata$undersec.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="undersec"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="undersec.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# shadow.cabinet
ids <- unique(data$id[data$shadow.cabinet==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$shadow.cabinet==0 & mindata$shadow.cabinet.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="shadow.cabinet"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="shadow.cabinet.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)


# frontbench.team
ids <- unique(data$id[data$frontbench.team==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$frontbench.team==0 & mindata$frontbench.team.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="frontbench.team"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="frontbench.team.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)


# com.chair
ids <- unique(data$id[data$com.chair==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$com.chair==0 & mindata$com.chair.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="com.chair"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="com.chair.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

# com.member
ids <- unique(data$id[data$com.member==1])
mindata <- data[data$id %in% ids,]
beforedata <- mindata[mindata$com.member==0 & mindata$com.member.post==0,]
meanbefore <- mean(beforedata$earnings.all.infl)
meanduring <- meanbefore*(exp(1)^(data.cur$ci_upper[data.cur$var=="com.member"]))
meandiff.current <- c(meandiff.current, meanduring - meanbefore)
meanafter <- meanbefore*(exp(1)^(data.post$ci_upper[data.post$var=="com.member.post"]))
meandiff.post <- c(meandiff.post, meanafter - meanbefore)

meandiff.current <- round(meandiff.current, 0)
meandiff.current <- rev(meandiff.current)
meandiff.post <- round(meandiff.post, 0)
meandiff.post <- rev(meandiff.post)


# plot
pdf(width=6*1.62, height=6, file="output/appendix/fig_a22.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T)), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T), max(targets)))+0.2), ylim=c(1-0.2,length(data.cur$coef)+0.3), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
	text(data.cur$ci_upper[i], i+0.2, meandiff.current[i], pos=4, cex=0.7)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
	text(data.post$ci_upper[i], i-0.2, meandiff.post[i], pos=4, cex=0.7, col="darkgray")
}

for(i in 1:length(targets)){
	lines(c(targets[i], targets[i]), c(i-0.25,i+0.25), lwd=3)
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()







### E.2.1 Effect of Positions on Job Titles

# jobcat_board
m7a <- m <- felm(jobcat_board ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m7a)


data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a23.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.post$ci_lower, na.rm=T), min(data.cur$ci_lower, na.rm=T))), max(c(max(data.post$ci_upper, na.rm=T), max(data.cur$ci_upper, na.rm=T)))), ylim=c(1-0.2,length(data.cur$coef)+0.2), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()


# jobcat_consultant
m7b <- m <- felm(jobcat_consultant ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m7b)


data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a24.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.post$ci_lower, na.rm=T), min(data.cur$ci_lower, na.rm=T))), max(c(max(data.post$ci_upper, na.rm=T), max(data.cur$ci_upper, na.rm=T)))), ylim=c(1-0.2,length(data.cur$coef)+0.2), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()



# jobcat_director
m7c <- m <- felm(jobcat_director ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m7c)


data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a25.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.post$ci_lower, na.rm=T), min(data.cur$ci_lower, na.rm=T))), max(c(max(data.post$ci_upper, na.rm=T), max(data.cur$ci_upper, na.rm=T)))), ylim=c(1-0.2,length(data.cur$coef)+0.2), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()




# jobcat_prof
m7d <- m <- felm(jobcat_prof ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m7d)


data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a26.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.post$ci_lower, na.rm=T), min(data.cur$ci_lower, na.rm=T))), max(c(max(data.post$ci_upper, na.rm=T), max(data.cur$ci_upper, na.rm=T)))), ylim=c(1-0.2,length(data.cur$coef)+0.2), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()







### E.2.2: Effect of Positions on Industries

# indcat_health
m8a <- m <- felm(indcat_health ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m8a)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a27.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.post$ci_lower, na.rm=T), min(data.cur$ci_lower, na.rm=T))), max(c(max(data.post$ci_upper, na.rm=T), max(data.cur$ci_upper, na.rm=T)))), ylim=c(1-0.2,length(data.cur$coef)+0.2), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()



# indcat_finance
m8b <- m <- felm(indcat_finance ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m8b)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a28.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.post$ci_lower, na.rm=T), min(data.cur$ci_lower, na.rm=T))), max(c(max(data.post$ci_upper, na.rm=T), max(data.cur$ci_upper, na.rm=T)))), ylim=c(1-0.2,length(data.cur$coef)+0.2), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()



# indcat_consulting
m8c <- m <- felm(indcat_consulting ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m8c)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a29.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.post$ci_lower, na.rm=T), min(data.cur$ci_lower, na.rm=T))), max(c(max(data.post$ci_upper, na.rm=T), max(data.cur$ci_upper, na.rm=T)))), ylim=c(1-0.2,length(data.cur$coef)+0.2), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()



# indcat_knowledge
m8d <- m <- felm(indcat_knowledge ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m8d)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a30.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.post$ci_lower, na.rm=T), min(data.cur$ci_lower, na.rm=T))), max(c(max(data.post$ci_upper, na.rm=T), max(data.cur$ci_upper, na.rm=T)))), ylim=c(1-0.2,length(data.cur$coef)+0.2), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()



# indcat_goods
m8e <- m <- felm(indcat_goods ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m8e)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a31.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.post$ci_lower, na.rm=T), min(data.cur$ci_lower, na.rm=T))), max(c(max(data.post$ci_upper, na.rm=T), max(data.cur$ci_upper, na.rm=T)))), ylim=c(1-0.2,length(data.cur$coef)+0.2), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()



# indcat_services
m8f <- m <- felm(indcat_services ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m8f)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a32.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.post$ci_lower, na.rm=T), min(data.cur$ci_lower, na.rm=T))), max(c(max(data.post$ci_upper, na.rm=T), max(data.cur$ci_upper, na.rm=T)))), ylim=c(1-0.2,length(data.cur$coef)+0.2), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()




# indcat_other
m8g <- m <- felm(indcat_other ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + com.member + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m8g)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.cur <- data1[1:7,]
data.post <- data1[8:14,]

data.cur$name <- data.post$name <- c("Minister", "Minister of State", "Parliamentary Secretary", "Shadow Cabinet", "Frontbench Team", "Committee Chair", "Committee Member")

data.cur <- data.cur[seq(dim(data.cur)[1],1),]
data.post <- data.post[seq(dim(data.post)[1],1),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a33.pdf")
par(mar = c(4,8,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.post$ci_lower, na.rm=T), min(data.cur$ci_lower, na.rm=T))), max(c(max(data.post$ci_upper, na.rm=T), max(data.cur$ci_upper, na.rm=T)))), ylim=c(1-0.2,length(data.cur$coef)+0.2), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=1.5)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.5)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=1.5, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.5, col="darkgray")
}

legend("bottomleft", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.5, 2.5), cex=1)
dev.off()





### E.3: Effect of Committee Membership on Earnings (Full Results)

m6 <- m <- felm(earnings.all.infl.log.1 ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + selcom.business + selcom.local + selcom.culture + selcom.defence + selcom.education + selcom.food.rural + selcom.foreign.affairs + selcom.health + selcom.home.affairs + selcom.int.dev + selcom.international.trade + selcom.justice + selcom.northern.ireland + selcom.science + selcom.scottland + selcom.transport + selcom.treasury + selcom.wales + selcom.work.pensions + selcom.energy.climatechange + selcom.environmental.audit + selcom.european.scrutiny + selcom.liaison + selcom.public.accounts + selcom.public.administration + selcom.armsexport.control + selcom.regulatory.reform + selcom.stat.instr + selcom.women + selcom.petitions + selcom.administration + selcom.backbench + selcom.finance.services + selcom.allowances + selcom.standards.priv + selcom.procedure + selcom.selection + com.house.commons + com.public.accounts + com.electoral.commission + com.parl.standards + com.ecclesiastical + com.intelligence.security + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + selcom.business.post + selcom.local.post + selcom.culture.post + selcom.defence.post + selcom.education.post + selcom.food.rural.post + selcom.foreign.affairs.post + selcom.health.post + selcom.home.affairs.post + selcom.int.dev.post + selcom.international.trade.post + selcom.justice.post + selcom.northern.ireland.post + selcom.science.post + selcom.scottland.post + selcom.transport.post + selcom.treasury.post + selcom.wales.post + selcom.work.pensions.post + selcom.energy.climatechange.post + selcom.environmental.audit.post + selcom.european.scrutiny.post + selcom.liaison.post + selcom.public.accounts.post + selcom.public.administration.post + selcom.armsexport.control.post + selcom.regulatory.reform.post + selcom.stat.instr.post + selcom.women.post + selcom.petitions.post + selcom.administration.post + selcom.backbench.post + selcom.finance.services.post + selcom.allowances.post + selcom.standards.priv.post + selcom.procedure.post + selcom.selection.post + com.house.commons.post + com.public.accounts.post + com.electoral.commission.post + com.parl.standards.post + com.ecclesiastical.post + com.intelligence.security.post + enter + leave | year + id | 0 | id, data=data)
summary(m6)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")


data.cur <- data1[7:49,]
data.post <- data1[56:98,]

data.cur$name <- data.post$name <- c("Business, Innovation and Skills", "Communities and Local Government", "Culture, Media and Sport", "Defense", "Education", "Food and Rural Affairs", "Foreign Affairs", "Health", "Home Affairs", "International Development", "International Trade", "Justice", "Northern Ireland Affairs", "Science", "Scottish Affairs", "Transport", "Treasury", "Welsh Affairs", "Work and Pensions", "Energy and Climate Change", "Environmental Audit", "European Scrutiny", "Liaison", "Public Accounts", "Public Administration", "Arms Export Controls", "Regulatory Reform", "Statutory Instruments", "Women and Equalities", "Petitions", "Administration", "Backbench Business", "Finance and Services", "Members' Allowances", "Standards and Privileges", "Procedure", "Selection", "House of Commons Commission", "Public Accounts Commission", "Electoral Commission", "Parliamentary Standards", "Ecclesiastical", "Intelligence and Security")

data.cur <- data.cur[order(data.cur$coef),]

keys <- join.keys(data.cur, data.post,c("name"))
matches <- match(keys$y, keys$x, nomatch=(keys$n+1))
data.post <- data.post[order(matches),]


pdf(width=8*1.62, height=8, file="output/appendix/fig_a34.pdf")
par(mar = c(4,12,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(data.post$ci_lower, na.rm=T), max(data.post$ci_upper, na.rm=T)), ylim=c(1,length(data.cur$coef)), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=0.9)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.2)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=0.9, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.2, col="darkgray")
}

legend("bottomright", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.2, 2.2), cex=c(0.75, 0.75))
dev.off()






### E.4.1: Effect of Committee Membership on Job Titles

# jobcat_board
m11a <- m <- felm(jobcat_board ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + selcom.business + selcom.local + selcom.culture + selcom.defence + selcom.education + selcom.food.rural + selcom.foreign.affairs + selcom.health + selcom.home.affairs + selcom.int.dev + selcom.international.trade + selcom.justice + selcom.northern.ireland + selcom.science + selcom.scottland + selcom.transport + selcom.treasury + selcom.wales + selcom.work.pensions + selcom.energy.climatechange + selcom.environmental.audit + selcom.european.scrutiny + selcom.liaison + selcom.public.accounts + selcom.public.administration + selcom.armsexport.control + selcom.regulatory.reform + selcom.stat.instr + selcom.women + selcom.petitions + selcom.administration + selcom.backbench + selcom.finance.services + selcom.allowances + selcom.standards.priv + selcom.procedure + selcom.selection + com.house.commons + com.public.accounts + com.electoral.commission + com.parl.standards + com.ecclesiastical + com.intelligence.security + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + selcom.business.post + selcom.local.post + selcom.culture.post + selcom.defence.post + selcom.education.post + selcom.food.rural.post + selcom.foreign.affairs.post + selcom.health.post + selcom.home.affairs.post + selcom.int.dev.post + selcom.international.trade.post + selcom.justice.post + selcom.northern.ireland.post + selcom.science.post + selcom.scottland.post + selcom.transport.post + selcom.treasury.post + selcom.wales.post + selcom.work.pensions.post + selcom.energy.climatechange.post + selcom.environmental.audit.post + selcom.european.scrutiny.post + selcom.liaison.post + selcom.public.accounts.post + selcom.public.administration.post + selcom.armsexport.control.post + selcom.regulatory.reform.post + selcom.stat.instr.post + selcom.women.post + selcom.petitions.post + selcom.administration.post + selcom.backbench.post + selcom.finance.services.post + selcom.allowances.post + selcom.standards.priv.post + selcom.procedure.post + selcom.selection.post + com.house.commons.post + com.public.accounts.post + com.electoral.commission.post + com.parl.standards.post + com.ecclesiastical.post + com.intelligence.security.post + enter + leave | year + id | 0 | id, data=data)
summary(m11a)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")


data.cur <- data1[7:49,]
data.post <- data1[56:98,]

data.cur$name <- data.post$name <- c("Business, Innovation and Skills", "Communities and Local Government", "Culture, Media and Sport", "Defense", "Education", "Food and Rural Affairs", "Foreign Affairs", "Health", "Home Affairs", "International Development", "International Trade", "Justice", "Northern Ireland Affairs", "Science", "Scottish Affairs", "Transport", "Treasury", "Welsh Affairs", "Work and Pensions", "Energy and Climate Change", "Environmental Audit", "European Scrutiny", "Liaison", "Public Accounts", "Public Administration", "Arms Export Controls", "Regulatory Reform", "Statutory Instruments", "Women and Equalities", "Petitions", "Administration", "Backbench Business", "Finance and Services", "Members' Allowances", "Standards and Privileges", "Procedure", "Selection", "House of Commons Commission", "Public Accounts Commission", "Electoral Commission", "Parliamentary Standards", "Ecclesiastical", "Intelligence and Security")

data.cur <- data.cur[order(data.cur$coef),]

keys <- join.keys(data.cur, data.post,c("name"))
matches <- match(keys$y, keys$x, nomatch=(keys$n+1))
data.post <- data.post[order(matches),]


pdf(width=8*1.62, height=8, file="output/appendix/fig_a35.pdf")
par(mar = c(4,12,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T))), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T)))), ylim=c(1,length(data.cur$coef)), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=0.9)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.2)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=0.9, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.2, col="darkgray")
}

legend("bottomright", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.2, 2.2), cex=0.75)
dev.off()



# jobcat_consultant
m11b <- m <- felm(jobcat_consultant ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + selcom.business + selcom.local + selcom.culture + selcom.defence + selcom.education + selcom.food.rural + selcom.foreign.affairs + selcom.health + selcom.home.affairs + selcom.int.dev + selcom.international.trade + selcom.justice + selcom.northern.ireland + selcom.science + selcom.scottland + selcom.transport + selcom.treasury + selcom.wales + selcom.work.pensions + selcom.energy.climatechange + selcom.environmental.audit + selcom.european.scrutiny + selcom.liaison + selcom.public.accounts + selcom.public.administration + selcom.armsexport.control + selcom.regulatory.reform + selcom.stat.instr + selcom.women + selcom.petitions + selcom.administration + selcom.backbench + selcom.finance.services + selcom.allowances + selcom.standards.priv + selcom.procedure + selcom.selection + com.house.commons + com.public.accounts + com.electoral.commission + com.parl.standards + com.ecclesiastical + com.intelligence.security + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + selcom.business.post + selcom.local.post + selcom.culture.post + selcom.defence.post + selcom.education.post + selcom.food.rural.post + selcom.foreign.affairs.post + selcom.health.post + selcom.home.affairs.post + selcom.int.dev.post + selcom.international.trade.post + selcom.justice.post + selcom.northern.ireland.post + selcom.science.post + selcom.scottland.post + selcom.transport.post + selcom.treasury.post + selcom.wales.post + selcom.work.pensions.post + selcom.energy.climatechange.post + selcom.environmental.audit.post + selcom.european.scrutiny.post + selcom.liaison.post + selcom.public.accounts.post + selcom.public.administration.post + selcom.armsexport.control.post + selcom.regulatory.reform.post + selcom.stat.instr.post + selcom.women.post + selcom.petitions.post + selcom.administration.post + selcom.backbench.post + selcom.finance.services.post + selcom.allowances.post + selcom.standards.priv.post + selcom.procedure.post + selcom.selection.post + com.house.commons.post + com.public.accounts.post + com.electoral.commission.post + com.parl.standards.post + com.ecclesiastical.post + com.intelligence.security.post + enter + leave | year + id | 0 | id, data=data)
summary(m11b)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")


data.cur <- data1[7:49,]
data.post <- data1[56:98,]

data.cur$name <- data.post$name <- c("Business, Innovation and Skills", "Communities and Local Government", "Culture, Media and Sport", "Defense", "Education", "Food and Rural Affairs", "Foreign Affairs", "Health", "Home Affairs", "International Development", "International Trade", "Justice", "Northern Ireland Affairs", "Science", "Scottish Affairs", "Transport", "Treasury", "Welsh Affairs", "Work and Pensions", "Energy and Climate Change", "Environmental Audit", "European Scrutiny", "Liaison", "Public Accounts", "Public Administration", "Arms Export Controls", "Regulatory Reform", "Statutory Instruments", "Women and Equalities", "Petitions", "Administration", "Backbench Business", "Finance and Services", "Members' Allowances", "Standards and Privileges", "Procedure", "Selection", "House of Commons Commission", "Public Accounts Commission", "Electoral Commission", "Parliamentary Standards", "Ecclesiastical", "Intelligence and Security")

data.cur <- data.cur[order(data.cur$coef),]

keys <- join.keys(data.cur, data.post,c("name"))
matches <- match(keys$y, keys$x, nomatch=(keys$n+1))
data.post <- data.post[order(matches),]


pdf(width=8*1.62, height=8, file="output/appendix/fig_a36.pdf")
par(mar = c(4,12,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T))), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T)))), ylim=c(1,length(data.cur$coef)), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=0.9)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.2)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=0.9, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.2, col="darkgray")
}

legend("bottomright", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.2, 2.2), cex=0.75)
dev.off()




# jobcat_director
m11c <- m <- felm(jobcat_director ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + selcom.business + selcom.local + selcom.culture + selcom.defence + selcom.education + selcom.food.rural + selcom.foreign.affairs + selcom.health + selcom.home.affairs + selcom.int.dev + selcom.international.trade + selcom.justice + selcom.northern.ireland + selcom.science + selcom.scottland + selcom.transport + selcom.treasury + selcom.wales + selcom.work.pensions + selcom.energy.climatechange + selcom.environmental.audit + selcom.european.scrutiny + selcom.liaison + selcom.public.accounts + selcom.public.administration + selcom.armsexport.control + selcom.regulatory.reform + selcom.stat.instr + selcom.women + selcom.petitions + selcom.administration + selcom.backbench + selcom.finance.services + selcom.allowances + selcom.standards.priv + selcom.procedure + selcom.selection + com.house.commons + com.public.accounts + com.electoral.commission + com.parl.standards + com.ecclesiastical + com.intelligence.security + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + selcom.business.post + selcom.local.post + selcom.culture.post + selcom.defence.post + selcom.education.post + selcom.food.rural.post + selcom.foreign.affairs.post + selcom.health.post + selcom.home.affairs.post + selcom.int.dev.post + selcom.international.trade.post + selcom.justice.post + selcom.northern.ireland.post + selcom.science.post + selcom.scottland.post + selcom.transport.post + selcom.treasury.post + selcom.wales.post + selcom.work.pensions.post + selcom.energy.climatechange.post + selcom.environmental.audit.post + selcom.european.scrutiny.post + selcom.liaison.post + selcom.public.accounts.post + selcom.public.administration.post + selcom.armsexport.control.post + selcom.regulatory.reform.post + selcom.stat.instr.post + selcom.women.post + selcom.petitions.post + selcom.administration.post + selcom.backbench.post + selcom.finance.services.post + selcom.allowances.post + selcom.standards.priv.post + selcom.procedure.post + selcom.selection.post + com.house.commons.post + com.public.accounts.post + com.electoral.commission.post + com.parl.standards.post + com.ecclesiastical.post + com.intelligence.security.post + enter + leave | year + id | 0 | id, data=data)
summary(m11c)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")


data.cur <- data1[7:49,]
data.post <- data1[56:98,]

data.cur$name <- data.post$name <- c("Business, Innovation and Skills", "Communities and Local Government", "Culture, Media and Sport", "Defense", "Education", "Food and Rural Affairs", "Foreign Affairs", "Health", "Home Affairs", "International Development", "International Trade", "Justice", "Northern Ireland Affairs", "Science", "Scottish Affairs", "Transport", "Treasury", "Welsh Affairs", "Work and Pensions", "Energy and Climate Change", "Environmental Audit", "European Scrutiny", "Liaison", "Public Accounts", "Public Administration", "Arms Export Controls", "Regulatory Reform", "Statutory Instruments", "Women and Equalities", "Petitions", "Administration", "Backbench Business", "Finance and Services", "Members' Allowances", "Standards and Privileges", "Procedure", "Selection", "House of Commons Commission", "Public Accounts Commission", "Electoral Commission", "Parliamentary Standards", "Ecclesiastical", "Intelligence and Security")

data.cur <- data.cur[order(data.cur$coef),]

keys <- join.keys(data.cur, data.post,c("name"))
matches <- match(keys$y, keys$x, nomatch=(keys$n+1))
data.post <- data.post[order(matches),]


pdf(width=8*1.62, height=8, file="output/appendix/fig_a37.pdf")
par(mar = c(4,12,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T))), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T)))), ylim=c(1,length(data.cur$coef)), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=0.9)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.2)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=0.9, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.2, col="darkgray")
}

legend("bottomright", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.2, 2.2), cex=0.75)
dev.off()




# jobcat_prof
m11c <- m <- felm(jobcat_prof ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + selcom.business + selcom.local + selcom.culture + selcom.defence + selcom.education + selcom.food.rural + selcom.foreign.affairs + selcom.health + selcom.home.affairs + selcom.int.dev + selcom.international.trade + selcom.justice + selcom.northern.ireland + selcom.science + selcom.scottland + selcom.transport + selcom.treasury + selcom.wales + selcom.work.pensions + selcom.energy.climatechange + selcom.environmental.audit + selcom.european.scrutiny + selcom.liaison + selcom.public.accounts + selcom.public.administration + selcom.armsexport.control + selcom.regulatory.reform + selcom.stat.instr + selcom.women + selcom.petitions + selcom.administration + selcom.backbench + selcom.finance.services + selcom.allowances + selcom.standards.priv + selcom.procedure + selcom.selection + com.house.commons + com.public.accounts + com.electoral.commission + com.parl.standards + com.ecclesiastical + com.intelligence.security + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + selcom.business.post + selcom.local.post + selcom.culture.post + selcom.defence.post + selcom.education.post + selcom.food.rural.post + selcom.foreign.affairs.post + selcom.health.post + selcom.home.affairs.post + selcom.int.dev.post + selcom.international.trade.post + selcom.justice.post + selcom.northern.ireland.post + selcom.science.post + selcom.scottland.post + selcom.transport.post + selcom.treasury.post + selcom.wales.post + selcom.work.pensions.post + selcom.energy.climatechange.post + selcom.environmental.audit.post + selcom.european.scrutiny.post + selcom.liaison.post + selcom.public.accounts.post + selcom.public.administration.post + selcom.armsexport.control.post + selcom.regulatory.reform.post + selcom.stat.instr.post + selcom.women.post + selcom.petitions.post + selcom.administration.post + selcom.backbench.post + selcom.finance.services.post + selcom.allowances.post + selcom.standards.priv.post + selcom.procedure.post + selcom.selection.post + com.house.commons.post + com.public.accounts.post + com.electoral.commission.post + com.parl.standards.post + com.ecclesiastical.post + com.intelligence.security.post + enter + leave | year + id | 0 | id, data=data)
summary(m11c)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")


data.cur <- data1[7:49,]
data.post <- data1[56:98,]

data.cur$name <- data.post$name <- c("Business, Innovation and Skills", "Communities and Local Government", "Culture, Media and Sport", "Defense", "Education", "Food and Rural Affairs", "Foreign Affairs", "Health", "Home Affairs", "International Development", "International Trade", "Justice", "Northern Ireland Affairs", "Science", "Scottish Affairs", "Transport", "Treasury", "Welsh Affairs", "Work and Pensions", "Energy and Climate Change", "Environmental Audit", "European Scrutiny", "Liaison", "Public Accounts", "Public Administration", "Arms Export Controls", "Regulatory Reform", "Statutory Instruments", "Women and Equalities", "Petitions", "Administration", "Backbench Business", "Finance and Services", "Members' Allowances", "Standards and Privileges", "Procedure", "Selection", "House of Commons Commission", "Public Accounts Commission", "Electoral Commission", "Parliamentary Standards", "Ecclesiastical", "Intelligence and Security")

data.cur <- data.cur[order(data.cur$coef),]

keys <- join.keys(data.cur, data.post,c("name"))
matches <- match(keys$y, keys$x, nomatch=(keys$n+1))
data.post <- data.post[order(matches),]


pdf(width=8*1.62, height=8, file="output/appendix/fig_a38.pdf")
par(mar = c(4,12,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T))), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T)))), ylim=c(1,length(data.cur$coef)), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=0.9)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.2)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=0.9, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.2, col="darkgray")
}

legend("bottomright", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.2, 2.2), cex=0.75)
dev.off()









### E.4.2: Effect of Committee Membership on Industries

# indcat_health
m10a <- m <- felm(indcat_health ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + selcom.business + selcom.local + selcom.culture + selcom.defence + selcom.education + selcom.food.rural + selcom.foreign.affairs + selcom.health + selcom.home.affairs + selcom.int.dev + selcom.international.trade + selcom.justice + selcom.northern.ireland + selcom.science + selcom.scottland + selcom.transport + selcom.treasury + selcom.wales + selcom.work.pensions + selcom.energy.climatechange + selcom.environmental.audit + selcom.european.scrutiny + selcom.liaison + selcom.public.accounts + selcom.public.administration + selcom.armsexport.control + selcom.regulatory.reform + selcom.stat.instr + selcom.women + selcom.petitions + selcom.administration + selcom.backbench + selcom.finance.services + selcom.allowances + selcom.standards.priv + selcom.procedure + selcom.selection + com.house.commons + com.public.accounts + com.electoral.commission + com.parl.standards + com.ecclesiastical + com.intelligence.security + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + selcom.business.post + selcom.local.post + selcom.culture.post + selcom.defence.post + selcom.education.post + selcom.food.rural.post + selcom.foreign.affairs.post + selcom.health.post + selcom.home.affairs.post + selcom.int.dev.post + selcom.international.trade.post + selcom.justice.post + selcom.northern.ireland.post + selcom.science.post + selcom.scottland.post + selcom.transport.post + selcom.treasury.post + selcom.wales.post + selcom.work.pensions.post + selcom.energy.climatechange.post + selcom.environmental.audit.post + selcom.european.scrutiny.post + selcom.liaison.post + selcom.public.accounts.post + selcom.public.administration.post + selcom.armsexport.control.post + selcom.regulatory.reform.post + selcom.stat.instr.post + selcom.women.post + selcom.petitions.post + selcom.administration.post + selcom.backbench.post + selcom.finance.services.post + selcom.allowances.post + selcom.standards.priv.post + selcom.procedure.post + selcom.selection.post + com.house.commons.post + com.public.accounts.post + com.electoral.commission.post + com.parl.standards.post + com.ecclesiastical.post + com.intelligence.security.post + enter + leave | year + id | 0 | id, data=data)
summary(m10a)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")


data.cur <- data1[7:49,]
data.post <- data1[56:98,]

data.cur$name <- data.post$name <- c("Business, Innovation and Skills", "Communities and Local Government", "Culture, Media and Sport", "Defense", "Education", "Food and Rural Affairs", "Foreign Affairs", "Health", "Home Affairs", "International Development", "International Trade", "Justice", "Northern Ireland Affairs", "Science", "Scottish Affairs", "Transport", "Treasury", "Welsh Affairs", "Work and Pensions", "Energy and Climate Change", "Environmental Audit", "European Scrutiny", "Liaison", "Public Accounts", "Public Administration", "Arms Export Controls", "Regulatory Reform", "Statutory Instruments", "Women and Equalities", "Petitions", "Administration", "Backbench Business", "Finance and Services", "Members' Allowances", "Standards and Privileges", "Procedure", "Selection", "House of Commons Commission", "Public Accounts Commission", "Electoral Commission", "Parliamentary Standards", "Ecclesiastical", "Intelligence and Security")

data.cur <- data.cur[order(data.cur$coef),]

keys <- join.keys(data.cur, data.post,c("name"))
matches <- match(keys$y, keys$x, nomatch=(keys$n+1))
data.post <- data.post[order(matches),]


pdf(width=8*1.62, height=8, file="output/appendix/fig_a39.pdf")
par(mar = c(4,12,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T))), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T)))), ylim=c(1,length(data.cur$coef)), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=0.9)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.2)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=0.9, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.2, col="darkgray")
}

legend("bottomright", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.2, 2.2), cex=0.75)
dev.off()


# indcat_finance
m10b <- m <- felm(indcat_finance ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + selcom.business + selcom.local + selcom.culture + selcom.defence + selcom.education + selcom.food.rural + selcom.foreign.affairs + selcom.health + selcom.home.affairs + selcom.int.dev + selcom.international.trade + selcom.justice + selcom.northern.ireland + selcom.science + selcom.scottland + selcom.transport + selcom.treasury + selcom.wales + selcom.work.pensions + selcom.energy.climatechange + selcom.environmental.audit + selcom.european.scrutiny + selcom.liaison + selcom.public.accounts + selcom.public.administration + selcom.armsexport.control + selcom.regulatory.reform + selcom.stat.instr + selcom.women + selcom.petitions + selcom.administration + selcom.backbench + selcom.finance.services + selcom.allowances + selcom.standards.priv + selcom.procedure + selcom.selection + com.house.commons + com.public.accounts + com.electoral.commission + com.parl.standards + com.ecclesiastical + com.intelligence.security + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + selcom.business.post + selcom.local.post + selcom.culture.post + selcom.defence.post + selcom.education.post + selcom.food.rural.post + selcom.foreign.affairs.post + selcom.health.post + selcom.home.affairs.post + selcom.int.dev.post + selcom.international.trade.post + selcom.justice.post + selcom.northern.ireland.post + selcom.science.post + selcom.scottland.post + selcom.transport.post + selcom.treasury.post + selcom.wales.post + selcom.work.pensions.post + selcom.energy.climatechange.post + selcom.environmental.audit.post + selcom.european.scrutiny.post + selcom.liaison.post + selcom.public.accounts.post + selcom.public.administration.post + selcom.armsexport.control.post + selcom.regulatory.reform.post + selcom.stat.instr.post + selcom.women.post + selcom.petitions.post + selcom.administration.post + selcom.backbench.post + selcom.finance.services.post + selcom.allowances.post + selcom.standards.priv.post + selcom.procedure.post + selcom.selection.post + com.house.commons.post + com.public.accounts.post + com.electoral.commission.post + com.parl.standards.post + com.ecclesiastical.post + com.intelligence.security.post + enter + leave | year + id | 0 | id, data=data)
summary(m10b)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")


data.cur <- data1[7:49,]
data.post <- data1[56:98,]

data.cur$name <- data.post$name <- c("Business, Innovation and Skills", "Communities and Local Government", "Culture, Media and Sport", "Defense", "Education", "Food and Rural Affairs", "Foreign Affairs", "Health", "Home Affairs", "International Development", "International Trade", "Justice", "Northern Ireland Affairs", "Science", "Scottish Affairs", "Transport", "Treasury", "Welsh Affairs", "Work and Pensions", "Energy and Climate Change", "Environmental Audit", "European Scrutiny", "Liaison", "Public Accounts", "Public Administration", "Arms Export Controls", "Regulatory Reform", "Statutory Instruments", "Women and Equalities", "Petitions", "Administration", "Backbench Business", "Finance and Services", "Members' Allowances", "Standards and Privileges", "Procedure", "Selection", "House of Commons Commission", "Public Accounts Commission", "Electoral Commission", "Parliamentary Standards", "Ecclesiastical", "Intelligence and Security")

data.cur <- data.cur[order(data.cur$coef),]

keys <- join.keys(data.cur, data.post,c("name"))
matches <- match(keys$y, keys$x, nomatch=(keys$n+1))
data.post <- data.post[order(matches),]


pdf(width=8*1.62, height=8, file="output/appendix/fig_a40.pdf")
par(mar = c(4,12,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T))), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T)))), ylim=c(1,length(data.cur$coef)), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=0.9)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.2)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=0.9, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.2, col="darkgray")
}

legend("bottomright", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.2, 2.2), cex=0.75)
dev.off()


# indcat_consulting
m10c <- m <- felm(indcat_consulting ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + selcom.business + selcom.local + selcom.culture + selcom.defence + selcom.education + selcom.food.rural + selcom.foreign.affairs + selcom.health + selcom.home.affairs + selcom.int.dev + selcom.international.trade + selcom.justice + selcom.northern.ireland + selcom.science + selcom.scottland + selcom.transport + selcom.treasury + selcom.wales + selcom.work.pensions + selcom.energy.climatechange + selcom.environmental.audit + selcom.european.scrutiny + selcom.liaison + selcom.public.accounts + selcom.public.administration + selcom.armsexport.control + selcom.regulatory.reform + selcom.stat.instr + selcom.women + selcom.petitions + selcom.administration + selcom.backbench + selcom.finance.services + selcom.allowances + selcom.standards.priv + selcom.procedure + selcom.selection + com.house.commons + com.public.accounts + com.electoral.commission + com.parl.standards + com.ecclesiastical + com.intelligence.security + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + selcom.business.post + selcom.local.post + selcom.culture.post + selcom.defence.post + selcom.education.post + selcom.food.rural.post + selcom.foreign.affairs.post + selcom.health.post + selcom.home.affairs.post + selcom.int.dev.post + selcom.international.trade.post + selcom.justice.post + selcom.northern.ireland.post + selcom.science.post + selcom.scottland.post + selcom.transport.post + selcom.treasury.post + selcom.wales.post + selcom.work.pensions.post + selcom.energy.climatechange.post + selcom.environmental.audit.post + selcom.european.scrutiny.post + selcom.liaison.post + selcom.public.accounts.post + selcom.public.administration.post + selcom.armsexport.control.post + selcom.regulatory.reform.post + selcom.stat.instr.post + selcom.women.post + selcom.petitions.post + selcom.administration.post + selcom.backbench.post + selcom.finance.services.post + selcom.allowances.post + selcom.standards.priv.post + selcom.procedure.post + selcom.selection.post + com.house.commons.post + com.public.accounts.post + com.electoral.commission.post + com.parl.standards.post + com.ecclesiastical.post + com.intelligence.security.post + enter + leave | year + id | 0 | id, data=data)
summary(m10c)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")


data.cur <- data1[7:49,]
data.post <- data1[56:98,]

data.cur$name <- data.post$name <- c("Business, Innovation and Skills", "Communities and Local Government", "Culture, Media and Sport", "Defense", "Education", "Food and Rural Affairs", "Foreign Affairs", "Health", "Home Affairs", "International Development", "International Trade", "Justice", "Northern Ireland Affairs", "Science", "Scottish Affairs", "Transport", "Treasury", "Welsh Affairs", "Work and Pensions", "Energy and Climate Change", "Environmental Audit", "European Scrutiny", "Liaison", "Public Accounts", "Public Administration", "Arms Export Controls", "Regulatory Reform", "Statutory Instruments", "Women and Equalities", "Petitions", "Administration", "Backbench Business", "Finance and Services", "Members' Allowances", "Standards and Privileges", "Procedure", "Selection", "House of Commons Commission", "Public Accounts Commission", "Electoral Commission", "Parliamentary Standards", "Ecclesiastical", "Intelligence and Security")

data.cur <- data.cur[order(data.cur$coef),]

keys <- join.keys(data.cur, data.post,c("name"))
matches <- match(keys$y, keys$x, nomatch=(keys$n+1))
data.post <- data.post[order(matches),]


pdf(width=8*1.62, height=8, file="output/appendix/fig_a41.pdf")
par(mar = c(4,12,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T))), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T)))), ylim=c(1,length(data.cur$coef)), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=0.9)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.2)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=0.9, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.2, col="darkgray")
}

legend("bottomright", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.2, 2.2), cex=0.75)
dev.off()


# indcat_knowledge
m10d <- m <- felm(indcat_knowledge ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + selcom.business + selcom.local + selcom.culture + selcom.defence + selcom.education + selcom.food.rural + selcom.foreign.affairs + selcom.health + selcom.home.affairs + selcom.int.dev + selcom.international.trade + selcom.justice + selcom.northern.ireland + selcom.science + selcom.scottland + selcom.transport + selcom.treasury + selcom.wales + selcom.work.pensions + selcom.energy.climatechange + selcom.environmental.audit + selcom.european.scrutiny + selcom.liaison + selcom.public.accounts + selcom.public.administration + selcom.armsexport.control + selcom.regulatory.reform + selcom.stat.instr + selcom.women + selcom.petitions + selcom.administration + selcom.backbench + selcom.finance.services + selcom.allowances + selcom.standards.priv + selcom.procedure + selcom.selection + com.house.commons + com.public.accounts + com.electoral.commission + com.parl.standards + com.ecclesiastical + com.intelligence.security + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + selcom.business.post + selcom.local.post + selcom.culture.post + selcom.defence.post + selcom.education.post + selcom.food.rural.post + selcom.foreign.affairs.post + selcom.health.post + selcom.home.affairs.post + selcom.int.dev.post + selcom.international.trade.post + selcom.justice.post + selcom.northern.ireland.post + selcom.science.post + selcom.scottland.post + selcom.transport.post + selcom.treasury.post + selcom.wales.post + selcom.work.pensions.post + selcom.energy.climatechange.post + selcom.environmental.audit.post + selcom.european.scrutiny.post + selcom.liaison.post + selcom.public.accounts.post + selcom.public.administration.post + selcom.armsexport.control.post + selcom.regulatory.reform.post + selcom.stat.instr.post + selcom.women.post + selcom.petitions.post + selcom.administration.post + selcom.backbench.post + selcom.finance.services.post + selcom.allowances.post + selcom.standards.priv.post + selcom.procedure.post + selcom.selection.post + com.house.commons.post + com.public.accounts.post + com.electoral.commission.post + com.parl.standards.post + com.ecclesiastical.post + com.intelligence.security.post + enter + leave | year + id | 0 | id, data=data)
summary(m10d)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")


data.cur <- data1[7:49,]
data.post <- data1[56:98,]

data.cur$name <- data.post$name <- c("Business, Innovation and Skills", "Communities and Local Government", "Culture, Media and Sport", "Defense", "Education", "Food and Rural Affairs", "Foreign Affairs", "Health", "Home Affairs", "International Development", "International Trade", "Justice", "Northern Ireland Affairs", "Science", "Scottish Affairs", "Transport", "Treasury", "Welsh Affairs", "Work and Pensions", "Energy and Climate Change", "Environmental Audit", "European Scrutiny", "Liaison", "Public Accounts", "Public Administration", "Arms Export Controls", "Regulatory Reform", "Statutory Instruments", "Women and Equalities", "Petitions", "Administration", "Backbench Business", "Finance and Services", "Members' Allowances", "Standards and Privileges", "Procedure", "Selection", "House of Commons Commission", "Public Accounts Commission", "Electoral Commission", "Parliamentary Standards", "Ecclesiastical", "Intelligence and Security")

data.cur <- data.cur[order(data.cur$coef),]

keys <- join.keys(data.cur, data.post,c("name"))
matches <- match(keys$y, keys$x, nomatch=(keys$n+1))
data.post <- data.post[order(matches),]


pdf(width=8*1.62, height=8, file="output/appendix/fig_a42.pdf")
par(mar = c(4,12,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T))), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T)))), ylim=c(1,length(data.cur$coef)), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=0.9)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.2)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=0.9, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.2, col="darkgray")
}

legend("bottomright", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.2, 2.2), cex=0.75)
dev.off()


# indcat_goods
m10e <- m <- felm(indcat_goods ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + selcom.business + selcom.local + selcom.culture + selcom.defence + selcom.education + selcom.food.rural + selcom.foreign.affairs + selcom.health + selcom.home.affairs + selcom.int.dev + selcom.international.trade + selcom.justice + selcom.northern.ireland + selcom.science + selcom.scottland + selcom.transport + selcom.treasury + selcom.wales + selcom.work.pensions + selcom.energy.climatechange + selcom.environmental.audit + selcom.european.scrutiny + selcom.liaison + selcom.public.accounts + selcom.public.administration + selcom.armsexport.control + selcom.regulatory.reform + selcom.stat.instr + selcom.women + selcom.petitions + selcom.administration + selcom.backbench + selcom.finance.services + selcom.allowances + selcom.standards.priv + selcom.procedure + selcom.selection + com.house.commons + com.public.accounts + com.electoral.commission + com.parl.standards + com.ecclesiastical + com.intelligence.security + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + selcom.business.post + selcom.local.post + selcom.culture.post + selcom.defence.post + selcom.education.post + selcom.food.rural.post + selcom.foreign.affairs.post + selcom.health.post + selcom.home.affairs.post + selcom.int.dev.post + selcom.international.trade.post + selcom.justice.post + selcom.northern.ireland.post + selcom.science.post + selcom.scottland.post + selcom.transport.post + selcom.treasury.post + selcom.wales.post + selcom.work.pensions.post + selcom.energy.climatechange.post + selcom.environmental.audit.post + selcom.european.scrutiny.post + selcom.liaison.post + selcom.public.accounts.post + selcom.public.administration.post + selcom.armsexport.control.post + selcom.regulatory.reform.post + selcom.stat.instr.post + selcom.women.post + selcom.petitions.post + selcom.administration.post + selcom.backbench.post + selcom.finance.services.post + selcom.allowances.post + selcom.standards.priv.post + selcom.procedure.post + selcom.selection.post + com.house.commons.post + com.public.accounts.post + com.electoral.commission.post + com.parl.standards.post + com.ecclesiastical.post + com.intelligence.security.post + enter + leave | year + id | 0 | id, data=data)
summary(m10e)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")


data.cur <- data1[7:49,]
data.post <- data1[56:98,]

data.cur$name <- data.post$name <- c("Business, Innovation and Skills", "Communities and Local Government", "Culture, Media and Sport", "Defense", "Education", "Food and Rural Affairs", "Foreign Affairs", "Health", "Home Affairs", "International Development", "International Trade", "Justice", "Northern Ireland Affairs", "Science", "Scottish Affairs", "Transport", "Treasury", "Welsh Affairs", "Work and Pensions", "Energy and Climate Change", "Environmental Audit", "European Scrutiny", "Liaison", "Public Accounts", "Public Administration", "Arms Export Controls", "Regulatory Reform", "Statutory Instruments", "Women and Equalities", "Petitions", "Administration", "Backbench Business", "Finance and Services", "Members' Allowances", "Standards and Privileges", "Procedure", "Selection", "House of Commons Commission", "Public Accounts Commission", "Electoral Commission", "Parliamentary Standards", "Ecclesiastical", "Intelligence and Security")

data.cur <- data.cur[order(data.cur$coef),]

keys <- join.keys(data.cur, data.post,c("name"))
matches <- match(keys$y, keys$x, nomatch=(keys$n+1))
data.post <- data.post[order(matches),]


pdf(width=8*1.62, height=8, file="output/appendix/fig_a43.pdf")
par(mar = c(4,12,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T))), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T)))), ylim=c(1,length(data.cur$coef)), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=0.9)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.2)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=0.9, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.2, col="darkgray")
}

legend("bottomright", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.2, 2.2), cex=0.75)
dev.off()


# indcat_services
m10f <- m <- felm(indcat_services ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + selcom.business + selcom.local + selcom.culture + selcom.defence + selcom.education + selcom.food.rural + selcom.foreign.affairs + selcom.health + selcom.home.affairs + selcom.int.dev + selcom.international.trade + selcom.justice + selcom.northern.ireland + selcom.science + selcom.scottland + selcom.transport + selcom.treasury + selcom.wales + selcom.work.pensions + selcom.energy.climatechange + selcom.environmental.audit + selcom.european.scrutiny + selcom.liaison + selcom.public.accounts + selcom.public.administration + selcom.armsexport.control + selcom.regulatory.reform + selcom.stat.instr + selcom.women + selcom.petitions + selcom.administration + selcom.backbench + selcom.finance.services + selcom.allowances + selcom.standards.priv + selcom.procedure + selcom.selection + com.house.commons + com.public.accounts + com.electoral.commission + com.parl.standards + com.ecclesiastical + com.intelligence.security + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + selcom.business.post + selcom.local.post + selcom.culture.post + selcom.defence.post + selcom.education.post + selcom.food.rural.post + selcom.foreign.affairs.post + selcom.health.post + selcom.home.affairs.post + selcom.int.dev.post + selcom.international.trade.post + selcom.justice.post + selcom.northern.ireland.post + selcom.science.post + selcom.scottland.post + selcom.transport.post + selcom.treasury.post + selcom.wales.post + selcom.work.pensions.post + selcom.energy.climatechange.post + selcom.environmental.audit.post + selcom.european.scrutiny.post + selcom.liaison.post + selcom.public.accounts.post + selcom.public.administration.post + selcom.armsexport.control.post + selcom.regulatory.reform.post + selcom.stat.instr.post + selcom.women.post + selcom.petitions.post + selcom.administration.post + selcom.backbench.post + selcom.finance.services.post + selcom.allowances.post + selcom.standards.priv.post + selcom.procedure.post + selcom.selection.post + com.house.commons.post + com.public.accounts.post + com.electoral.commission.post + com.parl.standards.post + com.ecclesiastical.post + com.intelligence.security.post + enter + leave | year + id | 0 | id, data=data)
summary(m10f)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")


data.cur <- data1[7:49,]
data.post <- data1[56:98,]

data.cur$name <- data.post$name <- c("Business, Innovation and Skills", "Communities and Local Government", "Culture, Media and Sport", "Defense", "Education", "Food and Rural Affairs", "Foreign Affairs", "Health", "Home Affairs", "International Development", "International Trade", "Justice", "Northern Ireland Affairs", "Science", "Scottish Affairs", "Transport", "Treasury", "Welsh Affairs", "Work and Pensions", "Energy and Climate Change", "Environmental Audit", "European Scrutiny", "Liaison", "Public Accounts", "Public Administration", "Arms Export Controls", "Regulatory Reform", "Statutory Instruments", "Women and Equalities", "Petitions", "Administration", "Backbench Business", "Finance and Services", "Members' Allowances", "Standards and Privileges", "Procedure", "Selection", "House of Commons Commission", "Public Accounts Commission", "Electoral Commission", "Parliamentary Standards", "Ecclesiastical", "Intelligence and Security")

data.cur <- data.cur[order(data.cur$coef),]

keys <- join.keys(data.cur, data.post,c("name"))
matches <- match(keys$y, keys$x, nomatch=(keys$n+1))
data.post <- data.post[order(matches),]


pdf(width=8*1.62, height=8, file="output/appendix/fig_a44.pdf")
par(mar = c(4,12,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T))), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T)))), ylim=c(1,length(data.cur$coef)), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=0.9)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.2)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=0.9, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.2, col="darkgray")
}

legend("bottomright", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.2, 2.2), cex=0.75)
dev.off()


# indcat_other
m10g <- m <- felm(indcat_other ~ minister + minister.state + undersec + shadow.cabinet + frontbench.team + com.chair + selcom.business + selcom.local + selcom.culture + selcom.defence + selcom.education + selcom.food.rural + selcom.foreign.affairs + selcom.health + selcom.home.affairs + selcom.int.dev + selcom.international.trade + selcom.justice + selcom.northern.ireland + selcom.science + selcom.scottland + selcom.transport + selcom.treasury + selcom.wales + selcom.work.pensions + selcom.energy.climatechange + selcom.environmental.audit + selcom.european.scrutiny + selcom.liaison + selcom.public.accounts + selcom.public.administration + selcom.armsexport.control + selcom.regulatory.reform + selcom.stat.instr + selcom.women + selcom.petitions + selcom.administration + selcom.backbench + selcom.finance.services + selcom.allowances + selcom.standards.priv + selcom.procedure + selcom.selection + com.house.commons + com.public.accounts + com.electoral.commission + com.parl.standards + com.ecclesiastical + com.intelligence.security + minister.post + minister.state.post + undersec.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + selcom.business.post + selcom.local.post + selcom.culture.post + selcom.defence.post + selcom.education.post + selcom.food.rural.post + selcom.foreign.affairs.post + selcom.health.post + selcom.home.affairs.post + selcom.int.dev.post + selcom.international.trade.post + selcom.justice.post + selcom.northern.ireland.post + selcom.science.post + selcom.scottland.post + selcom.transport.post + selcom.treasury.post + selcom.wales.post + selcom.work.pensions.post + selcom.energy.climatechange.post + selcom.environmental.audit.post + selcom.european.scrutiny.post + selcom.liaison.post + selcom.public.accounts.post + selcom.public.administration.post + selcom.armsexport.control.post + selcom.regulatory.reform.post + selcom.stat.instr.post + selcom.women.post + selcom.petitions.post + selcom.administration.post + selcom.backbench.post + selcom.finance.services.post + selcom.allowances.post + selcom.standards.priv.post + selcom.procedure.post + selcom.selection.post + com.house.commons.post + com.public.accounts.post + com.electoral.commission.post + com.parl.standards.post + com.ecclesiastical.post + com.intelligence.security.post + enter + leave | year + id | 0 | id, data=data)
summary(m10g)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")


data.cur <- data1[7:49,]
data.post <- data1[56:98,]

data.cur$name <- data.post$name <- c("Business, Innovation and Skills", "Communities and Local Government", "Culture, Media and Sport", "Defense", "Education", "Food and Rural Affairs", "Foreign Affairs", "Health", "Home Affairs", "International Development", "International Trade", "Justice", "Northern Ireland Affairs", "Science", "Scottish Affairs", "Transport", "Treasury", "Welsh Affairs", "Work and Pensions", "Energy and Climate Change", "Environmental Audit", "European Scrutiny", "Liaison", "Public Accounts", "Public Administration", "Arms Export Controls", "Regulatory Reform", "Statutory Instruments", "Women and Equalities", "Petitions", "Administration", "Backbench Business", "Finance and Services", "Members' Allowances", "Standards and Privileges", "Procedure", "Selection", "House of Commons Commission", "Public Accounts Commission", "Electoral Commission", "Parliamentary Standards", "Ecclesiastical", "Intelligence and Security")

data.cur <- data.cur[order(data.cur$coef),]

keys <- join.keys(data.cur, data.post,c("name"))
matches <- match(keys$y, keys$x, nomatch=(keys$n+1))
data.post <- data.post[order(matches),]


pdf(width=8*1.62, height=8, file="output/appendix/fig_a45.pdf")
par(mar = c(4,12,1,1), mgp=c(3,1,0))
plot(data.cur$coef, c(1:length(data.cur$coef)), type="n", xlim=c(min(c(min(data.cur$ci_lower, na.rm=T), min(data.post$ci_lower, na.rm=T))), max(c(max(data.cur$ci_upper, na.rm=T), max(data.post$ci_upper, na.rm=T)))), ylim=c(1,length(data.cur$coef)), yaxt="n", ylab="", xlab="Regression Coefficients")
axis(2, at=c(1:length(data.cur$coef)), data.cur$name, cex.axis=0.75, las=2)

abline(v=0, col="lightgrey", lwd=2)
abline(h=c(1:length(data.cur$coef)), col="lightgrey", lwd=0.7)

points(data.cur$coef, c(1:length(data.cur$coef))+0.2, pch=16, cex=0.9)
for(i in 1:length(data.cur$coef)){
	lines(c(data.cur$ci_lower[i], data.cur$ci_upper[i]), c(i+0.2,i+0.2), lwd=2.2)
}

points(data.post$coef, c(1:length(data.post$coef))-0.2, pch=16, cex=0.9, col="darkgray")
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i-0.2,i-0.2), lwd=2.2, col="darkgray")
}

legend("bottomright", lty=c(1, 1), pch=c(16, 16), col=c("black", "grey"), c("Current", "Post"), bg="white", lwd=c(2.2, 2.2), cex=0.75)
dev.off()







### E.5.1: Effect of Government Ministries on Job Titles

# jobcat_board
m <- felm(jobcat_board ~ home + women.equalities + cabinetoffice + education.science.employment + work.pensions + health + justice + housing.comm.locgov + trade.industry.business.energy + sport.culture.media + environment.agriculture + regions + defense + transport + treasury + foreign + shadow.cabinet + frontbench.team + com.chair + com.member + home.post + women.equalities.post + cabinetoffice.post + education.science.employment.post + work.pensions.post + health.post + justice.post + housing.comm.locgov.post + trade.industry.business.energy.post + sport.culture.media.post + environment.agriculture.post + regions.post + defense.post + transport.post + treasury.post + foreign.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.post <- data1[21:36,]

data.post$name <- c("Home Office", "Women, Equalities", "Cabinet Office", "Education, Science,\n Employment", "Work, Pensions, Social Security", "Health", "Justice", "Housing, Communities,\n Local Government", "Trade, Industry, Business, Energy", "Culture, Media, Sports", "Environment, Agriculture", "Regions", "Defense", "Transport", "Treasury", "Foreign, Commonwealth,\n Int. Development, Europe")


data.post <- data.post[order(data.post$coef),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a46.pdf")
par(mar = c(4,11,1,1), mgp=c(3,1,0))
plot(data.post$coef, c(1:length(data.post$coef)), type="n", xlim=c(min(data.post$ci_lower, na.rm=T), max(data.post$ci_upper, na.rm=T)), ylim=c(1,length(data.post$coef)), ylab="", xlab="Regression Coefficients", axes=F)
axis(1)
axis(2, at=c(1:length(data.post$coef)), data.post$name, cex.axis=0.75, las=2)

abline(v=0, col="grey", lwd=3)
abline(h=c(1:length(data.post$coef)), col="lightgrey", lwd=0.7)

points(data.post$coef, c(1:length(data.post$coef)), pch=16, cex=1.5)
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i,i), lwd=2.5)
}
dev.off()




# jobcat_consultant
m <- felm(jobcat_consultant ~ home + women.equalities + cabinetoffice + education.science.employment + work.pensions + health + justice + housing.comm.locgov + trade.industry.business.energy + sport.culture.media + environment.agriculture + regions + defense + transport + treasury + foreign + shadow.cabinet + frontbench.team + com.chair + com.member + home.post + women.equalities.post + cabinetoffice.post + education.science.employment.post + work.pensions.post + health.post + justice.post + housing.comm.locgov.post + trade.industry.business.energy.post + sport.culture.media.post + environment.agriculture.post + regions.post + defense.post + transport.post + treasury.post + foreign.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.post <- data1[21:36,]

data.post$name <- c("Home Office", "Women, Equalities", "Cabinet Office", "Education, Science,\n Employment", "Work, Pensions, Social Security", "Health", "Justice", "Housing, Communities,\n Local Government", "Trade, Industry, Business, Energy", "Culture, Media, Sports", "Environment, Agriculture", "Regions", "Defense", "Transport", "Treasury", "Foreign, Commonwealth,\n Int. Development, Europe")


data.post <- data.post[order(data.post$coef),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a47.pdf")
par(mar = c(4,11,1,1), mgp=c(3,1,0))
plot(data.post$coef, c(1:length(data.post$coef)), type="n", xlim=c(min(data.post$ci_lower, na.rm=T), max(data.post$ci_upper, na.rm=T)), ylim=c(1,length(data.post$coef)), ylab="", xlab="Regression Coefficients", axes=F)
axis(1)
axis(2, at=c(1:length(data.post$coef)), data.post$name, cex.axis=0.75, las=2)

abline(v=0, col="grey", lwd=3)
abline(h=c(1:length(data.post$coef)), col="lightgrey", lwd=0.7)

points(data.post$coef, c(1:length(data.post$coef)), pch=16, cex=1.5)
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i,i), lwd=2.5)
}
dev.off()





# jobcat_director
m <- felm(jobcat_director ~ home + women.equalities + cabinetoffice + education.science.employment + work.pensions + health + justice + housing.comm.locgov + trade.industry.business.energy + sport.culture.media + environment.agriculture + regions + defense + transport + treasury + foreign + shadow.cabinet + frontbench.team + com.chair + com.member + home.post + women.equalities.post + cabinetoffice.post + education.science.employment.post + work.pensions.post + health.post + justice.post + housing.comm.locgov.post + trade.industry.business.energy.post + sport.culture.media.post + environment.agriculture.post + regions.post + defense.post + transport.post + treasury.post + foreign.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.post <- data1[21:36,]

data.post$name <- c("Home Office", "Women, Equalities", "Cabinet Office", "Education, Science,\n Employment", "Work, Pensions, Social Security", "Health", "Justice", "Housing, Communities,\n Local Government", "Trade, Industry, Business, Energy", "Culture, Media, Sports", "Environment, Agriculture", "Regions", "Defense", "Transport", "Treasury", "Foreign, Commonwealth,\n Int. Development, Europe")


data.post <- data.post[order(data.post$coef),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a48.pdf")
par(mar = c(4,11,1,1), mgp=c(3,1,0))
plot(data.post$coef, c(1:length(data.post$coef)), type="n", xlim=c(min(data.post$ci_lower, na.rm=T), max(data.post$ci_upper, na.rm=T)), ylim=c(1,length(data.post$coef)), ylab="", xlab="Regression Coefficients", axes=F)
axis(1)
axis(2, at=c(1:length(data.post$coef)), data.post$name, cex.axis=0.75, las=2)

abline(v=0, col="grey", lwd=3)
abline(h=c(1:length(data.post$coef)), col="lightgrey", lwd=0.7)

points(data.post$coef, c(1:length(data.post$coef)), pch=16, cex=1.5)
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i,i), lwd=2.5)
}
dev.off()




# jobcat_prof
m <- felm(jobcat_prof ~ home + women.equalities + cabinetoffice + education.science.employment + work.pensions + health + justice + housing.comm.locgov + trade.industry.business.energy + sport.culture.media + environment.agriculture + regions + defense + transport + treasury + foreign + shadow.cabinet + frontbench.team + com.chair + com.member + home.post + women.equalities.post + cabinetoffice.post + education.science.employment.post + work.pensions.post + health.post + justice.post + housing.comm.locgov.post + trade.industry.business.energy.post + sport.culture.media.post + environment.agriculture.post + regions.post + defense.post + transport.post + treasury.post + foreign.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.post <- data1[21:36,]

data.post$name <- c("Home Office", "Women, Equalities", "Cabinet Office", "Education, Science,\n Employment", "Work, Pensions, Social Security", "Health", "Justice", "Housing, Communities,\n Local Government", "Trade, Industry, Business, Energy", "Culture, Media, Sports", "Environment, Agriculture", "Regions", "Defense", "Transport", "Treasury", "Foreign, Commonwealth,\n Int. Development, Europe")


data.post <- data.post[order(data.post$coef),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a49.pdf")
par(mar = c(4,11,1,1), mgp=c(3,1,0))
plot(data.post$coef, c(1:length(data.post$coef)), type="n", xlim=c(min(data.post$ci_lower, na.rm=T), max(data.post$ci_upper, na.rm=T)), ylim=c(1,length(data.post$coef)), ylab="", xlab="Regression Coefficients", axes=F)
axis(1)
axis(2, at=c(1:length(data.post$coef)), data.post$name, cex.axis=0.75, las=2)

abline(v=0, col="grey", lwd=3)
abline(h=c(1:length(data.post$coef)), col="lightgrey", lwd=0.7)

points(data.post$coef, c(1:length(data.post$coef)), pch=16, cex=1.5)
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i,i), lwd=2.5)
}
dev.off()





### E.5.2: Effect of Government Ministries on Industries

# indcat_health
m9a <- m <- felm(indcat_health ~ home + women.equalities + cabinetoffice + education.science.employment + work.pensions + health + justice + housing.comm.locgov + trade.industry.business.energy + sport.culture.media + environment.agriculture + regions + defense + transport + treasury + foreign + shadow.cabinet + frontbench.team + com.chair + com.member + home.post + women.equalities.post + cabinetoffice.post + education.science.employment.post + work.pensions.post + health.post + justice.post + housing.comm.locgov.post + trade.industry.business.energy.post + sport.culture.media.post + environment.agriculture.post + regions.post + defense.post + transport.post + treasury.post + foreign.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m9a)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.post <- data1[21:36,]

data.post$name <- c("Home Office", "Women, Equalities", "Cabinet Office", "Education, Science,\n Employment", "Work, Pensions, Social Security", "Health", "Justice", "Housing, Communities,\n Local Government", "Trade, Industry, Business, Energy", "Culture, Media, Sports", "Environment, Agriculture", "Regions", "Defense", "Transport", "Treasury", "Foreign, Commonwealth,\n Int. Development, Europe")


data.post <- data.post[order(data.post$coef),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a50.pdf")
par(mar = c(4,11,1,1), mgp=c(3,1,0))
plot(data.post$coef, c(1:length(data.post$coef)), type="n", xlim=c(min(data.post$ci_lower, na.rm=T), max(data.post$ci_upper, na.rm=T)), ylim=c(1,length(data.post$coef)), ylab="", xlab="Regression Coefficients", axes=F)
axis(1)
axis(2, at=c(1:length(data.post$coef)), data.post$name, cex.axis=0.75, las=2)

abline(v=0, col="grey", lwd=3)
abline(h=c(1:length(data.post$coef)), col="lightgrey", lwd=0.7)

points(data.post$coef, c(1:length(data.post$coef)), pch=16, cex=1.5)
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i,i), lwd=2.5)
}
dev.off()


# indcat_finance
m9b <- m <- felm(indcat_finance ~ home + women.equalities + cabinetoffice + education.science.employment + work.pensions + health + justice + housing.comm.locgov + trade.industry.business.energy + sport.culture.media + environment.agriculture + regions + defense + transport + treasury + foreign + shadow.cabinet + frontbench.team + com.chair + com.member + home.post + women.equalities.post + cabinetoffice.post + education.science.employment.post + work.pensions.post + health.post + justice.post + housing.comm.locgov.post + trade.industry.business.energy.post + sport.culture.media.post + environment.agriculture.post + regions.post + defense.post + transport.post + treasury.post + foreign.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m9b)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.post <- data1[21:36,]

data.post$name <- c("Home Office", "Women, Equalities", "Cabinet Office", "Education, Science,\n Employment", "Work, Pensions, Social Security", "Health", "Justice", "Housing, Communities,\n Local Government", "Trade, Industry, Business, Energy", "Culture, Media, Sports", "Environment, Agriculture", "Regions", "Defense", "Transport", "Treasury", "Foreign, Commonwealth,\n Int. Development, Europe")


data.post <- data.post[order(data.post$coef),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a51.pdf")
par(mar = c(4,11,1,1), mgp=c(3,1,0))
plot(data.post$coef, c(1:length(data.post$coef)), type="n", xlim=c(min(data.post$ci_lower, na.rm=T), max(data.post$ci_upper, na.rm=T)), ylim=c(1,length(data.post$coef)), ylab="", xlab="Regression Coefficients", axes=F)
axis(1)
axis(2, at=c(1:length(data.post$coef)), data.post$name, cex.axis=0.75, las=2)

abline(v=0, col="grey", lwd=3)
abline(h=c(1:length(data.post$coef)), col="lightgrey", lwd=0.7)

points(data.post$coef, c(1:length(data.post$coef)), pch=16, cex=1.5)
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i,i), lwd=2.5)
}
dev.off()



# indcat_consulting
m9c <- m <- felm(indcat_consulting ~ home + women.equalities + cabinetoffice + education.science.employment + work.pensions + health + justice + housing.comm.locgov + trade.industry.business.energy + sport.culture.media + environment.agriculture + regions + defense + transport + treasury + foreign + shadow.cabinet + frontbench.team + com.chair + com.member + home.post + women.equalities.post + cabinetoffice.post + education.science.employment.post + work.pensions.post + health.post + justice.post + housing.comm.locgov.post + trade.industry.business.energy.post + sport.culture.media.post + environment.agriculture.post + regions.post + defense.post + transport.post + treasury.post + foreign.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m9c)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.post <- data1[21:36,]

data.post$name <- c("Home Office", "Women, Equalities", "Cabinet Office", "Education, Science,\n Employment", "Work, Pensions, Social Security", "Health", "Justice", "Housing, Communities,\n Local Government", "Trade, Industry, Business, Energy", "Culture, Media, Sports", "Environment, Agriculture", "Regions", "Defense", "Transport", "Treasury", "Foreign, Commonwealth,\n Int. Development, Europe")


data.post <- data.post[order(data.post$coef),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a52.pdf")
par(mar = c(4,11,1,1), mgp=c(3,1,0))
plot(data.post$coef, c(1:length(data.post$coef)), type="n", xlim=c(min(data.post$ci_lower, na.rm=T), max(data.post$ci_upper, na.rm=T)), ylim=c(1,length(data.post$coef)), ylab="", xlab="Regression Coefficients", axes=F)
axis(1)
axis(2, at=c(1:length(data.post$coef)), data.post$name, cex.axis=0.75, las=2)

abline(v=0, col="grey", lwd=3)
abline(h=c(1:length(data.post$coef)), col="lightgrey", lwd=0.7)

points(data.post$coef, c(1:length(data.post$coef)), pch=16, cex=1.5)
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i,i), lwd=2.5)
}
dev.off()


# indcat_knowledge
m9d <- m <- felm(indcat_knowledge ~ home + women.equalities + cabinetoffice + education.science.employment + work.pensions + health + justice + housing.comm.locgov + trade.industry.business.energy + sport.culture.media + environment.agriculture + regions + defense + transport + treasury + foreign + shadow.cabinet + frontbench.team + com.chair + com.member + home.post + women.equalities.post + cabinetoffice.post + education.science.employment.post + work.pensions.post + health.post + justice.post + housing.comm.locgov.post + trade.industry.business.energy.post + sport.culture.media.post + environment.agriculture.post + regions.post + defense.post + transport.post + treasury.post + foreign.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m9d)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.post <- data1[21:36,]

data.post$name <- c("Home Office", "Women, Equalities", "Cabinet Office", "Education, Science,\n Employment", "Work, Pensions, Social Security", "Health", "Justice", "Housing, Communities,\n Local Government", "Trade, Industry, Business, Energy", "Culture, Media, Sports", "Environment, Agriculture", "Regions", "Defense", "Transport", "Treasury", "Foreign, Commonwealth,\n Int. Development, Europe")


data.post <- data.post[order(data.post$coef),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a53.pdf")
par(mar = c(4,11,1,1), mgp=c(3,1,0))
plot(data.post$coef, c(1:length(data.post$coef)), type="n", xlim=c(min(data.post$ci_lower, na.rm=T), max(data.post$ci_upper, na.rm=T)), ylim=c(1,length(data.post$coef)), ylab="", xlab="Regression Coefficients", axes=F)
axis(1)
axis(2, at=c(1:length(data.post$coef)), data.post$name, cex.axis=0.75, las=2)

abline(v=0, col="grey", lwd=3)
abline(h=c(1:length(data.post$coef)), col="lightgrey", lwd=0.7)

points(data.post$coef, c(1:length(data.post$coef)), pch=16, cex=1.5)
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i,i), lwd=2.5)
}
dev.off()


# indcat_goods
m9e <- m <- felm(indcat_goods ~ home + women.equalities + cabinetoffice + education.science.employment + work.pensions + health + justice + housing.comm.locgov + trade.industry.business.energy + sport.culture.media + environment.agriculture + regions + defense + transport + treasury + foreign + shadow.cabinet + frontbench.team + com.chair + com.member + home.post + women.equalities.post + cabinetoffice.post + education.science.employment.post + work.pensions.post + health.post + justice.post + housing.comm.locgov.post + trade.industry.business.energy.post + sport.culture.media.post + environment.agriculture.post + regions.post + defense.post + transport.post + treasury.post + foreign.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m9e)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.post <- data1[21:36,]

data.post$name <- c("Home Office", "Women, Equalities", "Cabinet Office", "Education, Science,\n Employment", "Work, Pensions, Social Security", "Health", "Justice", "Housing, Communities,\n Local Government", "Trade, Industry, Business, Energy", "Culture, Media, Sports", "Environment, Agriculture", "Regions", "Defense", "Transport", "Treasury", "Foreign, Commonwealth,\n Int. Development, Europe")


data.post <- data.post[order(data.post$coef),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a54.pdf")
par(mar = c(4,11,1,1), mgp=c(3,1,0))
plot(data.post$coef, c(1:length(data.post$coef)), type="n", xlim=c(min(data.post$ci_lower, na.rm=T), max(data.post$ci_upper, na.rm=T)), ylim=c(1,length(data.post$coef)), ylab="", xlab="Regression Coefficients", axes=F)
axis(1)
axis(2, at=c(1:length(data.post$coef)), data.post$name, cex.axis=0.75, las=2)

abline(v=0, col="grey", lwd=3)
abline(h=c(1:length(data.post$coef)), col="lightgrey", lwd=0.7)

points(data.post$coef, c(1:length(data.post$coef)), pch=16, cex=1.5)
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i,i), lwd=2.5)
}
dev.off()


# indcat_services
m9f <- m <- felm(indcat_services ~ home + women.equalities + cabinetoffice + education.science.employment + work.pensions + health + justice + housing.comm.locgov + trade.industry.business.energy + sport.culture.media + environment.agriculture + regions + defense + transport + treasury + foreign + shadow.cabinet + frontbench.team + com.chair + com.member + home.post + women.equalities.post + cabinetoffice.post + education.science.employment.post + work.pensions.post + health.post + justice.post + housing.comm.locgov.post + trade.industry.business.energy.post + sport.culture.media.post + environment.agriculture.post + regions.post + defense.post + transport.post + treasury.post + foreign.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m9f)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.post <- data1[21:36,]

data.post$name <- c("Home Office", "Women, Equalities", "Cabinet Office", "Education, Science,\n Employment", "Work, Pensions, Social Security", "Health", "Justice", "Housing, Communities,\n Local Government", "Trade, Industry, Business, Energy", "Culture, Media, Sports", "Environment, Agriculture", "Regions", "Defense", "Transport", "Treasury", "Foreign, Commonwealth,\n Int. Development, Europe")


data.post <- data.post[order(data.post$coef),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a55.pdf")
par(mar = c(4,11,1,1), mgp=c(3,1,0))
plot(data.post$coef, c(1:length(data.post$coef)), type="n", xlim=c(min(data.post$ci_lower, na.rm=T), max(data.post$ci_upper, na.rm=T)), ylim=c(1,length(data.post$coef)), ylab="", xlab="Regression Coefficients", axes=F)
axis(1)
axis(2, at=c(1:length(data.post$coef)), data.post$name, cex.axis=0.75, las=2)

abline(v=0, col="grey", lwd=3)
abline(h=c(1:length(data.post$coef)), col="lightgrey", lwd=0.7)

points(data.post$coef, c(1:length(data.post$coef)), pch=16, cex=1.5)
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i,i), lwd=2.5)
}
dev.off()


# indcat_other
m9g <- m <- felm(indcat_other ~ home + women.equalities + cabinetoffice + education.science.employment + work.pensions + health + justice + housing.comm.locgov + trade.industry.business.energy + sport.culture.media + environment.agriculture + regions + defense + transport + treasury + foreign + shadow.cabinet + frontbench.team + com.chair + com.member + home.post + women.equalities.post + cabinetoffice.post + education.science.employment.post + work.pensions.post + health.post + justice.post + housing.comm.locgov.post + trade.industry.business.energy.post + sport.culture.media.post + environment.agriculture.post + regions.post + defense.post + transport.post + treasury.post + foreign.post + shadow.cabinet.post + frontbench.team.post + com.chair.post + com.member.post + enter + leave | year + id | 0 | id, data=data)
summary(m9g)

data1 <- data.frame(rownames(m$coefficients), m$coefficients, m$coefficients+qnorm(0.025)*sqrt(diag(m$clustervcv)), m$coefficients+qnorm(0.975)*sqrt(diag(m$clustervcv)))
colnames(data1) <- c("var", "coef", "ci_lower", "ci_upper")

data.post <- data1[21:36,]

data.post$name <- c("Home Office", "Women, Equalities", "Cabinet Office", "Education, Science,\n Employment", "Work, Pensions, Social Security", "Health", "Justice", "Housing, Communities,\n Local Government", "Trade, Industry, Business, Energy", "Culture, Media, Sports", "Environment, Agriculture", "Regions", "Defense", "Transport", "Treasury", "Foreign, Commonwealth,\n Int. Development, Europe")


data.post <- data.post[order(data.post$coef),]


pdf(width=6*1.62, height=6, file="output/appendix/fig_a56.pdf")
par(mar = c(4,11,1,1), mgp=c(3,1,0))
plot(data.post$coef, c(1:length(data.post$coef)), type="n", xlim=c(min(data.post$ci_lower, na.rm=T), max(data.post$ci_upper, na.rm=T)), ylim=c(1,length(data.post$coef)), ylab="", xlab="Regression Coefficients", axes=F)
axis(1)
axis(2, at=c(1:length(data.post$coef)), data.post$name, cex.axis=0.75, las=2)

abline(v=0, col="grey", lwd=3)
abline(h=c(1:length(data.post$coef)), col="lightgrey", lwd=0.7)

points(data.post$coef, c(1:length(data.post$coef)), pch=16, cex=1.5)
for(i in 1:length(data.post$coef)){
	lines(c(data.post$ci_lower[i], data.post$ci_upper[i]), c(i,i), lwd=2.5)
}
dev.off()








